summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2024-08-15 00:11:58 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2024-08-24 21:36:07 +0800
commit5d22d37aa8b93efaad797faf80db40ea59453481 (patch)
tree1a929fd85e38d102f23707092c145488c4417ecc /drivers/crypto
parentb63483b37e813299445d2719488acab2b3f20544 (diff)
crypto: spacc - Fix off by one in spacc_isenabled()
The spacc->config.modes[] array has CRYPTO_MODE_LAST number of elements so this > comparison should be >= to prevent an out of bounds access. Fixes: c8981d9230d8 ("crypto: spacc - Add SPAcc Skcipher support") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/dwc-spacc/spacc_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/dwc-spacc/spacc_core.c b/drivers/crypto/dwc-spacc/spacc_core.c
index e3380528e82b..b7630f559973 100644
--- a/drivers/crypto/dwc-spacc/spacc_core.c
+++ b/drivers/crypto/dwc-spacc/spacc_core.c
@@ -1295,7 +1295,7 @@ int spacc_isenabled(struct spacc_device *spacc, int mode, int keysize)
{
int x;
- if (mode < 0 || mode > CRYPTO_MODE_LAST)
+ if (mode < 0 || mode >= CRYPTO_MODE_LAST)
return 0;
if (mode == CRYPTO_MODE_NULL ||