From patchwork Tue Aug 14 06:49:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Singh X-Patchwork-Id: 10565071 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 71CA61815 for ; Tue, 14 Aug 2018 06:50:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67A6429684 for ; Tue, 14 Aug 2018 06:50:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6594829618; Tue, 14 Aug 2018 06:50:33 +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 19A3D296AB for ; Tue, 14 Aug 2018 06:50:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731789AbeHNJgT (ORCPT ); Tue, 14 Aug 2018 05:36:19 -0400 Received: from esa2.microchip.iphmx.com ([68.232.149.84]:41316 "EHLO esa2.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727670AbeHNJgT (ORCPT ); Tue, 14 Aug 2018 05:36:19 -0400 X-IronPort-AV: E=Sophos;i="5.53,237,1531810800"; d="scan'208";a="17924166" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Aug 2018 23:50:32 -0700 Received: from ajaysk-VirtualBox.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Mon, 13 Aug 2018 23:50:30 -0700 From: Ajay Singh To: CC: , , , , , , , Ajay Singh Subject: [PATCH 03/24] staging: wilc1000: fix to use correct index to free scanned info in clear_shadow_scan() Date: Tue, 14 Aug 2018 12:19:55 +0530 Message-ID: <1534229416-13254-4-git-send-email-ajay.kathat@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> References: <1534229416-13254-1-git-send-email-ajay.kathat@microchip.com> MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fixes to use correct index to free the allocated memory for ies information. The check was done using 'last_scanned_cnt' index and its not correct, so use the correct index ('i') to check for before freeing the allocated memory. Signed-off-by: Ajay Singh --- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index d853508..ede9134 100644 --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -165,9 +165,9 @@ static void clear_shadow_scan(void) return; for (i = 0; i < last_scanned_cnt; i++) { - if (last_scanned_shadow[last_scanned_cnt].ies) { + if (last_scanned_shadow[i].ies) { kfree(last_scanned_shadow[i].ies); - last_scanned_shadow[last_scanned_cnt].ies = NULL; + last_scanned_shadow[i].ies = NULL; } kfree(last_scanned_shadow[i].join_params);