[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220602072234.54593-1-wupeng58@huawei.com>
Date: Thu, 2 Jun 2022 07:22:34 +0000
From: Peng Wu <wupeng58@...wei.com>
To: <clabbe.montjoie@...il.com>, <herbert@...dor.apana.org.au>,
<davem@...emloft.net>, <jernej.skrabec@...il.com>,
<samuel@...lland.org>
CC: <linux-crypto@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-sunxi@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<liwei391@...wei.com>, <wupeng58@...wei.com>
Subject: [PATCH] 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 <wupeng58@...wei.com>
Reported-by: Hulk Robot <hulkci@...wei.com>
---
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c
index ac417a6b39e5..90334e435673 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);
--
2.17.1
Powered by blists - more mailing lists