Commit b751bc77 authored by Wei Yongjun's avatar Wei Yongjun Committed by Greg Kroah-Hartman

staging: lustre: fix return value check in capa_hmac()

In case of error, the function crypto_alloc_hash() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a3c383c5
...@@ -272,10 +272,10 @@ int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key) ...@@ -272,10 +272,10 @@ int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key)
alg = &capa_hmac_algs[capa_alg(capa)]; alg = &capa_hmac_algs[capa_alg(capa)];
tfm = crypto_alloc_hash(alg->ha_name, 0, 0); tfm = crypto_alloc_hash(alg->ha_name, 0, 0);
if (!tfm) { if (IS_ERR(tfm)) {
CERROR("crypto_alloc_tfm failed, check whether your kernel" CERROR("crypto_alloc_tfm failed, check whether your kernel"
"has crypto support!\n"); "has crypto support!\n");
return -ENOMEM; return PTR_ERR(tfm);
} }
keylen = alg->ha_keylen; keylen = alg->ha_keylen;
......
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