From: Peng Wu Date: Thu, 2 Jun 2022 07:22:34 +0000 (+0000) Subject: crypto: sun8i-ss - fix a NULL vs IS_ERR() check in sun8i_ss_hashkey X-Git-Tag: v6.6.17~6939^2~69 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e8df1fc2d669d04c1f8a9e2d61d7afba1b43df4;p=platform%2Fkernel%2Flinux-rpi.git crypto: sun8i-ss - fix a NULL vs IS_ERR() check in sun8i_ss_hashkey The crypto_alloc_shash() function never returns NULL. It returns error pointers. Fixes: 801b7d572c0a ("crypto: sun8i-ss - add hmac(sha1)") Signed-off-by: Peng Wu Reported-by: Hulk Robot Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c index 845019b..36a82b2 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c @@ -30,8 +30,8 @@ static int sun8i_ss_hashkey(struct sun8i_ss_hash_tfm_ctx *tfmctx, const u8 *key, int ret = 0; xtfm = crypto_alloc_shash("sha1", 0, CRYPTO_ALG_NEED_FALLBACK); - if (!xtfm) - return -ENOMEM; + if (IS_ERR(xtfm)) + return PTR_ERR(xtfm); len = sizeof(*sdesc) + crypto_shash_descsize(xtfm); sdesc = kmalloc(len, GFP_KERNEL);