From: Oleg Drokin Date: Tue, 31 Dec 2013 01:38:49 +0000 (-0500) Subject: LU-4423 obdclass: fix return value check in capa_hmac() X-Git-Tag: 2.5.56~12 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a32a2faaa95e4e3379511dd2e8d5493496437867;hp=8ce48257490f20ec7f11929a42ab3891139a9d8c LU-4423 obdclass: 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: Wei Yongjun Signed-off-by: Oleg Drokin Change-Id: I4889387752d1eb5400649cd5f4da172d64c054e2 Reviewed-on: http://review.whamcloud.com/8681 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdclass/capa.c b/lustre/obdclass/capa.c index 5f5bc1b..29c40c1 100644 --- a/lustre/obdclass/capa.c +++ b/lustre/obdclass/capa.c @@ -258,10 +258,10 @@ int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key) alg = &capa_hmac_algs[capa_alg(capa)]; tfm = crypto_alloc_hash(alg->ha_name, 0, 0); - if (!tfm) { + if (IS_ERR(tfm)) { CERROR("crypto_alloc_tfm failed, check whether your kernel" "has crypto support!\n"); - return -ENOMEM; + return PTR_ERR(tfm); } keylen = alg->ha_keylen;