crypto: qat - silence a static checker warning
authorTadeusz Struk <tadeusz.struk@intel.com>
Sat, 22 Aug 2015 15:29:30 +0000 (08:29 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 24 Aug 2015 14:07:44 +0000 (22:07 +0800)
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>
drivers/crypto/qat/qat_common/adf_transport.c

index d5d81985cd4b609826256e3a13cefabe3c4494eb..3865ae8d96d9cda8a96a01d0ccfe49e70b3cf7b6 100644 (file)
@@ -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)) {