Commit 55e8dba1 authored by Tadeusz Struk's avatar Tadeusz Struk Committed by Herbert Xu

crypto: qat - silence a static checker warning

Add range check for ring number.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTadeusz Struk <tadeusz.struk@intel.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 73613a81
...@@ -264,6 +264,10 @@ int adf_create_ring(struct adf_accel_dev *accel_dev, const char *section, ...@@ -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"); dev_err(&GET_DEV(accel_dev), "Can't get ring number\n");
return -EFAULT; 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]; bank = &transport_data->banks[bank_num];
if (adf_reserve_ring(bank, ring_num)) { if (adf_reserve_ring(bank, ring_num)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment