All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tadeusz Struk <tadeusz.struk@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Bruce Allan <bruce.w.allan@intel.com>,
	Pingchao Yang <pingchao.yang@intel.com>,
	qat-linux@intel.com, linux-crypto@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch -next] crypto: qat - uint8_t is not large enough for accel_id
Date: Thu, 10 Dec 2015 22:23:03 +0000	[thread overview]
Message-ID: <5669FB47.60308@intel.com> (raw)
In-Reply-To: <20151210220044.GA21797@mwanda>

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 <dan.carpenter@oracle.com>
> 
> 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 <dan.carpenter@oracle.com>
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---

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;


WARNING: multiple messages have this Message-ID (diff)
From: Tadeusz Struk <tadeusz.struk@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Bruce Allan <bruce.w.allan@intel.com>,
	Pingchao Yang <pingchao.yang@intel.com>,
	qat-linux@intel.com, linux-crypto@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch -next] crypto: qat - uint8_t is not large enough for accel_id
Date: Thu, 10 Dec 2015 14:23:03 -0800	[thread overview]
Message-ID: <5669FB47.60308@intel.com> (raw)
In-Reply-To: <20151210220044.GA21797@mwanda>

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 <dan.carpenter@oracle.com>
> 
> 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 <dan.carpenter@oracle.com>
Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
---

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;


  reply	other threads:[~2015-12-10 22:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 22:00 [patch -next] crypto: qat - uint8_t is not large enough for accel_id Dan Carpenter
2015-12-10 22:00 ` Dan Carpenter
2015-12-10 22:23 ` Tadeusz Struk [this message]
2015-12-10 22:23   ` Tadeusz Struk
2015-12-14 13:33   ` Herbert Xu
2015-12-14 13:33     ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5669FB47.60308@intel.com \
    --to=tadeusz.struk@intel.com \
    --cc=bruce.w.allan@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=pingchao.yang@intel.com \
    --cc=qat-linux@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.