Commit 7e8df1fc authored by Peng Wu's avatar Peng Wu Committed by Herbert Xu
Browse files

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: 801b7d57 ("crypto: sun8i-ss - add hmac(sha1)")
Signed-off-by: default avatarPeng Wu <wupeng58@huawei.com>
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent b03c0dc0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);