Commit 5d22d37a authored by Dan Carpenter's avatar Dan Carpenter Committed by Herbert Xu

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: c8981d92 ("crypto: spacc - Add SPAcc Skcipher support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent b63483b3
......@@ -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 ||
......
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