Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1622968

[PATCH 1/2] crypto: chcr - Improve error checking

From Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Newsgroups linux.kernel
Subject [PATCH 1/2] crypto: chcr - Improve error checking
Date 2017-04-13 14:20 +0200
Message-ID <tvLTc-2Sx-19@gated-at.bofh.it> (permalink)
References <tvLTc-2Sx-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


'chcr_alloc_shash()' can return NULL. Here it is not possible because this
code is reached only if 'get_alg_config()' a few lines above has succeeded.
So we are garanteed that the value of 'max_authsize' is a correct
parameter.
Anyway, this is harmless to add a check for NULL.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/crypto/chelsio/chcr_algo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index 41bc7f4f58cd..f19590ac8775 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -2294,7 +2294,7 @@ static int chcr_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
 			    aeadctx->enckey_len << 3);
 
 	base_hash  = chcr_alloc_shash(max_authsize);
-	if (IS_ERR(base_hash)) {
+	if (IS_ERR_OR_NULL(base_hash)) {
 		pr_err("chcr : Base driver cannot be loaded\n");
 		goto out;
 	}
-- 
2.11.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] crypto: chcr - Improve error checking Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-04-13 14:20 +0200
  Re: [PATCH 1/2] crypto: chcr - Improve error checking Dan Carpenter <dan.carpenter@oracle.com> - 2017-04-13 16:10 +0200

csiph-web