From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753457AbdDMMOW (ORCPT ); Thu, 13 Apr 2017 08:14:22 -0400 Received: from smtp13.smtpout.orange.fr ([80.12.242.135]:54043 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753197AbdDMMOU (ORCPT ); Thu, 13 Apr 2017 08:14:20 -0400 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 13 Apr 2017 14:14:18 +0200 X-ME-IP: 92.140.232.30 From: Christophe JAILLET To: herbert@gondor.apana.org.au, davem@davemloft.net, harsh@chelsio.com, hariprasad@chelsio.com Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 1/2] crypto: chcr - Improve error checking Date: Thu, 13 Apr 2017 14:14:19 +0200 Message-Id: <71c63ef360ba033c1321e9792228b1e7b728c88e.1492085165.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org '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 --- 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