Skip to content

Commit

Permalink
crypto: qat - prevent underflow in rp2srv_store()
Browse files Browse the repository at this point in the history
The "ring" variable has an upper bounds check but nothing checks for
negatives.  This code uses kstrtouint() already and it was obviously
intended to be declared as unsigned int.  Make it so.

Fixes: dbc8876 ("crypto: qat - add rp2svc sysfs attribute")
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Giovanni Cabiddu <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Dan Carpenter authored and herbertx committed Nov 17, 2023
1 parent bc197f5 commit e53c741
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/crypto/intel/qat/qat_common/adf_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ static ssize_t rp2srv_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct adf_accel_dev *accel_dev;
int ring, num_rings, ret;
int num_rings, ret;
unsigned int ring;

accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
if (!accel_dev)
Expand Down

0 comments on commit e53c741

Please sign in to comment.