summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorTadeusz Struk <tadeusz.struk@intel.com>2015-08-22 18:29:30 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2015-08-24 17:07:44 +0300
commit55e8dba1acc2e3e9d77226c3b08b25a02a0e3a3a (patch)
tree75a04d98fa6c4b54c7fd7ffcc5425419cbb9b0a2 /drivers/crypto
parent73613a8159ddbf5a9ead0c03174458fa8210bdf7 (diff)
downloadlinux-55e8dba1acc2e3e9d77226c3b08b25a02a0e3a3a.tar.xz
crypto: qat - silence a static checker warning
Add range check for ring number. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/qat/qat_common/adf_transport.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c
index d5d81985cd4b..3865ae8d96d9 100644
--- a/drivers/crypto/qat/qat_common/adf_transport.c
+++ b/drivers/crypto/qat/qat_common/adf_transport.c
@@ -264,6 +264,10 @@ int adf_create_ring(struct adf_accel_dev *accel_dev, const char *section,
dev_err(&GET_DEV(accel_dev), "Can't get ring number\n");
return -EFAULT;
}
+ if (ring_num >= ADF_ETR_MAX_RINGS_PER_BANK) {
+ dev_err(&GET_DEV(accel_dev), "Invalid ring number\n");
+ return -EFAULT;
+ }
bank = &transport_data->banks[bank_num];
if (adf_reserve_ring(bank, ring_num)) {