diff options
author | Peng Wu <wupeng58@huawei.com> | 2022-06-02 10:22:34 +0300 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2022-06-10 11:43:50 +0300 |
commit | 7e8df1fc2d669d04c1f8a9e2d61d7afba1b43df4 (patch) | |
tree | 2232bbd406791012499650d71679d479e8b9e97d /drivers/crypto/allwinner | |
parent | b03c0dc0788abccc7a25ef7dff5818f4123bb992 (diff) | |
download | linux-7e8df1fc2d669d04c1f8a9e2d61d7afba1b43df4.tar.xz |
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@huawei.com>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/allwinner')
-rw-r--r-- | drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 4 |
1 files 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 845019bd9591..36a82b22953c 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); |