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: c8981d9230 ("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>
This commit is contained in:
Dan Carpenter 2024-08-15 00:11:58 +03:00 committed by Herbert Xu
parent b63483b37e
commit 5d22d37aa8

View File

@ -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 ||