linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch -next] crypto: qat - uint8_t is not large enough for accel_id
@ 2015-12-10 22:00 Dan Carpenter
  2015-12-10 22:23 ` Tadeusz Struk
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-12-10 22:00 UTC (permalink / raw)
  To: Tadeusz Struk
  Cc: Herbert Xu, David S. Miller, Bruce Allan, Pingchao Yang,
	qat-linux, linux-crypto, kernel-janitors

->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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch -next] crypto: qat - uint8_t is not large enough for accel_id
  2015-12-10 22:00 [patch -next] crypto: qat - uint8_t is not large enough for accel_id Dan Carpenter
@ 2015-12-10 22:23 ` Tadeusz Struk
  2015-12-14 13:33   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Tadeusz Struk @ 2015-12-10 22:23 UTC (permalink / raw)
  To: Dan Carpenter, Herbert Xu
  Cc: David S. Miller, Bruce Allan, Pingchao Yang, qat-linux,
	linux-crypto, kernel-janitors

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;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch -next] crypto: qat - uint8_t is not large enough for accel_id
  2015-12-10 22:23 ` Tadeusz Struk
@ 2015-12-14 13:33   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2015-12-14 13:33 UTC (permalink / raw)
  To: Tadeusz Struk
  Cc: Dan Carpenter, David S. Miller, Bruce Allan, Pingchao Yang,
	qat-linux, linux-crypto, kernel-janitors

On Thu, Dec 10, 2015 at 02:23:03PM -0800, Tadeusz Struk wrote:
>
> 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>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-14 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-10 22:00 [patch -next] crypto: qat - uint8_t is not large enough for accel_id Dan Carpenter
2015-12-10 22:23 ` Tadeusz Struk
2015-12-14 13:33   ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).