Skip to contentSkip to conversation

crypto: sun8i-ss - fix a NULL vs IS_ERR() check in sun8i_ss_hashkey

PATCH In review Peng Wu 2 participants 2 messages Jun 2, 2022 – Jun 10, 2022

Subsystems (3)
lore
Share & tools
lore

Peng Wu

author
#0 lore raw

PATCH 1/1 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)")
---
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c +2 -2
index ac417a6b39e5..90334e435673 100644
@@ -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);
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 9 lines · Peng Wu

The crypto_alloc_shash() function never returns NULL. It returns error pointers.

Fixes 801b7d572c0a ("crypto: sun8i-ss - add hmac(sha1)")
---
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt