linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: sun8i-ss - fix a NULL vs IS_ERR() check in sun8i_ss_hashkey
@ 2022-06-02  7:22 Peng Wu
  2022-06-10  9:17 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Peng Wu @ 2022-06-02  7:22 UTC (permalink / raw)
  To: clabbe.montjoie, herbert, davem, jernej.skrabec, samuel
  Cc: linux-crypto, linux-arm-kernel, linux-sunxi, linux-kernel,
	liwei391, wupeng58

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@huawei.com>
Reported-by: Hulk Robot <hulkci@huawei.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: sun8i-ss - fix a NULL vs IS_ERR() check in sun8i_ss_hashkey
  2022-06-02  7:22 [PATCH] crypto: sun8i-ss - fix a NULL vs IS_ERR() check in sun8i_ss_hashkey Peng Wu
@ 2022-06-10  9:17 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2022-06-10  9:17 UTC (permalink / raw)
  To: Peng Wu
  Cc: clabbe.montjoie, davem, jernej.skrabec, samuel, linux-crypto,
	linux-arm-kernel, linux-sunxi, linux-kernel, liwei391

On Thu, Jun 02, 2022 at 07:22:34AM +0000, Peng Wu wrote:
> 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@huawei.com>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> ---
>  drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-10  9:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02  7:22 [PATCH] crypto: sun8i-ss - fix a NULL vs IS_ERR() check in sun8i_ss_hashkey Peng Wu
2022-06-10  9:17 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).