[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAPgLHd-H27vdFP857hs5CqnQdgT6XSW+CrtoXodMRHPX8f+N3A@mail.gmail.com>
Date: Fri, 20 Dec 2013 11:41:11 +0800
From: Wei Yongjun <weiyj.lk@...il.com>
To: gregkh@...uxfoundation.org, andreas.dilger@...el.com,
sachin.kamat@...aro.org, tao.peng@....com
Cc: yongjun_wei@...ndmicro.com.cn, devel@...verdev.osuosl.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] staging: lustre: fix return value check in capa_hmac()
From: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
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 <yongjun_wei@...ndmicro.com.cn>
---
drivers/staging/lustre/lustre/obdclass/capa.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/lustre/lustre/obdclass/capa.c b/drivers/staging/lustre/lustre/obdclass/capa.c
index 68d797b..039232d 100644
--- a/drivers/staging/lustre/lustre/obdclass/capa.c
+++ b/drivers/staging/lustre/lustre/obdclass/capa.c
@@ -273,10 +273,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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists