crypto: qat - uint8_t is not large enough for accel_id
Subsystems (2)
PATCH 1/1 crypto: qat - uint8_t is not large enough for accel_id
->accel_id has to be large enough to hold ADF_MAX_DEVICES + 1 (which is 1025) so uint8_t is too small.
drivers/crypto/qat/qat_common/adf_accel_devices.h +1 -1
@@ -251,6 +251,6 @@ struct adf_accel_dev { } vf; };bool is_vf; -uint8_t accel_id; +unsigned int accel_id; } __packed;#endif
Hi Dan,
Quoted 11 lines · Dan Carpenter
->accel_id has to be large enough to hold
ADF_MAX_DEVICES+ 1 (which is 1025) souint8_tis too small.Fixes 890c55f4dc0e ('crypto: qat - add support for c3xxx accel type')Signed-off-by Dan Carpenter <[email protected]>drivers/crypto/qat/qat_common/adf_accel_devices.h +0
-0
drivers/crypto/qat/qat_common/adf_accel_devices.h struct adf_accel_dev { · line 256
Quoted 7 lines
drivers/crypto/qat/qat_common/adf_accel_devices.h +1
-1@@ -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.
---
drivers/crypto/qat/qat_common/adf_accel_devices.h +1 -1
@@ -251,6 +251,6 @@ struct adf_accel_dev { } vf; };bool is_vf; -uint8_t accel_id; +u32 accel_id; } __packed;#endif
drivers/crypto/qat/qat_common/adf_cfg_common.h +2 -2
@@ -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;
Herbert Xu
maintainerQuoted 6 lines · Tadeusz Struk
accel_idhas to be large enough to holdADF_MAX_DEVICES+ 1 (which is > 1025) souint8_tis too small.Reported-by Dan Carpenter <[email protected]>Signed-off-by Tadeusz Struk <[email protected]>
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt