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

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
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment