mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-04 01:24:12 +08:00
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: 801b7d572c
("crypto: sun8i-ss - add hmac(sha1)")
Signed-off-by: Peng Wu <wupeng58@huawei.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
b03c0dc078
commit
7e8df1fc2d
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user