From patchwork Thu Dec 10 22:23:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tadeusz Struk X-Patchwork-Id: 7822641 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 67F919FB32 for ; Thu, 10 Dec 2015 22:26:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9514F205C4 for ; Thu, 10 Dec 2015 22:26:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A57E7205C2 for ; Thu, 10 Dec 2015 22:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752093AbbLJW0S (ORCPT ); Thu, 10 Dec 2015 17:26:18 -0500 Received: from mga09.intel.com ([134.134.136.24]:59502 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751647AbbLJW0S (ORCPT ); Thu, 10 Dec 2015 17:26:18 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 10 Dec 2015 14:26:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,410,1444719600"; d="scan'208";a="838802065" Received: from tstruk-mobl1.jf.intel.com (HELO tstruk-mobl1.intel.com) ([134.134.171.167]) by orsmga001.jf.intel.com with ESMTP; 10 Dec 2015 14:26:17 -0800 Subject: Re: [patch -next] crypto: qat - uint8_t is not large enough for accel_id To: Dan Carpenter , Herbert Xu References: <20151210220044.GA21797@mwanda> Cc: "David S. Miller" , Bruce Allan , Pingchao Yang , qat-linux@intel.com, linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org From: Tadeusz Struk Message-ID: <5669FB47.60308@intel.com> Date: Thu, 10 Dec 2015 14:23:03 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <20151210220044.GA21797@mwanda> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Dan, On 12/10/2015 02:00 PM, Dan Carpenter wrote: > ->accel_id has to be large enough to hold ADF_MAX_DEVICES + 1 (which is > 1025) so uint8_t is too small. > > Fixes: 890c55f4dc0e ('crypto: qat - add support for c3xxx accel type') > Signed-off-by: Dan Carpenter > > diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h > index 4d78ec0..1e1cdef 100644 > --- a/drivers/crypto/qat/qat_common/adf_accel_devices.h > +++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h > @@ -251,6 +251,6 @@ struct adf_accel_dev { > } vf; > }; > bool is_vf; > - uint8_t accel_id; > + unsigned int accel_id; > } __packed; > #endif Yes, that's correct. That was part of my next patchset, but since you sent the patch.. We also need to change the corresponding field in the struct adf_dev_status_info, and change the instance_id to match the instance_id in the adf_hw_device_data struct. I would also prefer u32 instead of unsigned int. ---8<--- accel_id has to be large enough to hold ADF_MAX_DEVICES + 1 (which is > 1025) so uint8_t is too small. Reported-by: Dan Carpenter Signed-off-by: Tadeusz Struk --- -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h index 4d78ec0..f96d427 100644 --- a/drivers/crypto/qat/qat_common/adf_accel_devices.h +++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h @@ -251,6 +251,6 @@ struct adf_accel_dev { } vf; }; bool is_vf; - uint8_t accel_id; + u32 accel_id; } __packed; #endif diff --git a/drivers/crypto/qat/qat_common/adf_cfg_common.h b/drivers/crypto/qat/qat_common/adf_cfg_common.h index 673dbf7..8c4f657 100644 --- a/drivers/crypto/qat/qat_common/adf_cfg_common.h +++ b/drivers/crypto/qat/qat_common/adf_cfg_common.h @@ -80,8 +80,8 @@ enum adf_device_type { struct adf_dev_status_info { enum adf_device_type type; - uint8_t accel_id; - uint8_t instance_id; + u32 accel_id; + u32 instance_id; uint8_t num_ae; uint8_t num_accel; uint8_t num_logical_accel;