From patchwork Wed Apr 25 15:06:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atul Gupta X-Patchwork-Id: 10363437 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 7C66F6032C for ; Wed, 25 Apr 2018 15:06:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 495A128D8E for ; Wed, 25 Apr 2018 15:06:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47B3828E33; Wed, 25 Apr 2018 15:06:34 +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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 2E68228D8E for ; Wed, 25 Apr 2018 15:06:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754610AbeDYPGc (ORCPT ); Wed, 25 Apr 2018 11:06:32 -0400 Received: from stargate.chelsio.com ([12.32.117.8]:21569 "EHLO stargate.chelsio.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754567AbeDYPGc (ORCPT ); Wed, 25 Apr 2018 11:06:32 -0400 Received: from chumthang.asicdesigners.com (indra-ipmi.blr.asicdesigners.com [10.193.186.96] (may be forged)) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w3PF6OOH031151; Wed, 25 Apr 2018 08:06:25 -0700 From: Atul Gupta To: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org Cc: dan.carpenter@oracle.com Subject: [PATCH 5/7] chtls: free beyond end of array rspq_skb_cache Date: Wed, 25 Apr 2018 20:36:22 +0530 Message-Id: <1524668782-1581-1-git-send-email-atul.gupta@chelsio.com> X-Mailer: git-send-email 1.8.3.1 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 Reported-by: Dan Carpenter Signed-off-by: Atul Gupta --- drivers/crypto/chelsio/chtls/chtls_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/chelsio/chtls/chtls_main.c b/drivers/crypto/chelsio/chtls/chtls_main.c index e9ffc3d..4dc3d0e 100644 --- a/drivers/crypto/chelsio/chtls/chtls_main.c +++ b/drivers/crypto/chelsio/chtls/chtls_main.c @@ -198,7 +198,7 @@ static void *chtls_uld_add(const struct cxgb4_lld_info *info) { struct cxgb4_lld_info *lldi; struct chtls_dev *cdev; - int i, j; + int i; cdev = kzalloc(sizeof(*cdev) + info->nports * (sizeof(struct net_device *)), GFP_KERNEL); @@ -250,8 +250,8 @@ static void *chtls_uld_add(const struct cxgb4_lld_info *info) return cdev; out_rspq_skb: - for (j = 0; j <= i; j++) - kfree_skb(cdev->rspq_skb_cache[j]); + for (; i > 0; --i) + kfree_skb(cdev->rspq_skb_cache[i]); kfree_skb(cdev->askb); out_skb: kfree(lldi);