diff mbox series

crypto: qat - (qat_420xx) fix off by one in uof_get_name()

Message ID 796ecd7c-54ad-4bec-b748-3e156cc0a1aa@stanley.mountain
State Accepted
Commit 93a11608fb3720e1bc2b19a2649ac2b49cca1921
Headers show
Series crypto: qat - (qat_420xx) fix off by one in uof_get_name() | expand

Commit Message

Dan Carpenter Sept. 28, 2024, 10:05 a.m. UTC
This is called from uof_get_name_420xx() where "num_objs" is the
ARRAY_SIZE() of fw_objs[].  The > needs to be >= to prevent an out of
bounds access.

Fixes: fcf60f4bcf54 ("crypto: qat - add support for 420xx devices")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cabiddu, Giovanni Oct. 1, 2024, 11:05 a.m. UTC | #1
On Sat, Sep 28, 2024 at 01:05:01PM +0300, Dan Carpenter wrote:
> This is called from uof_get_name_420xx() where "num_objs" is the
> ARRAY_SIZE() of fw_objs[].  The > needs to be >= to prevent an out of
> bounds access.
> 
> Fixes: fcf60f4bcf54 ("crypto: qat - add support for 420xx devices")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Herbert Xu Oct. 5, 2024, 5:38 a.m. UTC | #2
On Sat, Sep 28, 2024 at 01:05:01PM +0300, Dan Carpenter wrote:
> This is called from uof_get_name_420xx() where "num_objs" is the
> ARRAY_SIZE() of fw_objs[].  The > needs to be >= to prevent an out of
> bounds access.
> 
> Fixes: fcf60f4bcf54 ("crypto: qat - add support for 420xx devices")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c b/drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c
index 78f0ea49254d..9faef33e54bd 100644
--- a/drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c
+++ b/drivers/crypto/intel/qat/qat_420xx/adf_420xx_hw_data.c
@@ -375,7 +375,7 @@  static const char *uof_get_name(struct adf_accel_dev *accel_dev, u32 obj_num,
 	else
 		id = -EINVAL;
 
-	if (id < 0 || id > num_objs)
+	if (id < 0 || id >= num_objs)
 		return NULL;
 
 	return fw_objs[id];