diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-10-31 09:58:32 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2023-11-17 12:16:29 +0100 |
commit | e53c741303a59ee1682e11f61b7772863e02526d (patch) | |
tree | 4e8e30e2313667ec5c5cee0d2b9e5b48e2f9e9ac | |
parent | crypto: drbg - Remove SHA1 from drbg (diff) | |
download | linux-e53c741303a59ee1682e11f61b7772863e02526d.tar.xz linux-e53c741303a59ee1682e11f61b7772863e02526d.zip |
crypto: qat - prevent underflow in rp2srv_store()
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: dbc8876dd873 ("crypto: qat - add rp2svc sysfs attribute")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | drivers/crypto/intel/qat/qat_common/adf_sysfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/intel/qat/qat_common/adf_sysfs.c b/drivers/crypto/intel/qat/qat_common/adf_sysfs.c index ddffc98119c6..6f0b3629da13 100644 --- a/drivers/crypto/intel/qat/qat_common/adf_sysfs.c +++ b/drivers/crypto/intel/qat/qat_common/adf_sysfs.c @@ -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) |