From patchwork Thu Apr 13 12:14:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 9679293 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0CE0860383 for ; Thu, 13 Apr 2017 12:14:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1E7028654 for ; Thu, 13 Apr 2017 12:14:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6D442865A; Thu, 13 Apr 2017 12:14:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F97128659 for ; Thu, 13 Apr 2017 12:14:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753372AbdDMMOV (ORCPT ); Thu, 13 Apr 2017 08:14:21 -0400 Received: from smtp13.smtpout.orange.fr ([80.12.242.135]:55315 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752534AbdDMMOU (ORCPT ); Thu, 13 Apr 2017 08:14:20 -0400 Received: from localhost.localdomain ([92.140.232.30]) by mwinf5d75 with ME id 7oEH1v00m0g0jYk03oEHJh; Thu, 13 Apr 2017 14:14:18 +0200 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-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP '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; }