From patchwork Fri Jan 13 15:35:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9515899 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.web.codeaurora.org (Postfix) with ESMTP id 0BD3060762 for ; Fri, 13 Jan 2017 15:36:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3A8228584 for ; Fri, 13 Jan 2017 15:36:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6CFA28606; Fri, 13 Jan 2017 15:36:10 +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, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 90DFC28584 for ; Fri, 13 Jan 2017 15:36:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752111AbdAMPfy (ORCPT ); Fri, 13 Jan 2017 10:35:54 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:53571 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752064AbdAMPfx (ORCPT ); Fri, 13 Jan 2017 10:35:53 -0500 Received: from wuerfel.lan ([78.43.21.235]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0LqYDd-1cwyjI17Mf-00e0ni; Fri, 13 Jan 2017 16:35:37 +0100 From: Arnd Bergmann To: Amitkumar Karwar , Kalle Valo Cc: Arnd Bergmann , Nishant Sarmukadam , Brian Norris , Xinming Hu , Cathy Luo , Shengzhen Li , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mwifiex: fix uninitialized variable access in pcie_remove Date: Fri, 13 Jan 2017 16:35:03 +0100 Message-Id: <20170113153534.2617372-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:XGB2koR8o1PT1Cog36PE9qcNML/Y7NuJ0t9ZGVu71lyRKb/2AiP N1Jl2ZpopXMZ9hW2WbGuJSkZx0AEif0obnVJa8fs7eaqEmYU8a6+gSuusXqnONxzqPNGctj 8QLATLxNfCGpxeBaZyVsMCZvMmsGbfkTqlqyhqKjNJe2vu/8JW1wMGOXLPrzEnBVZO56mAf TBbsUun5yWUb1bjD0ldGg== X-UI-Out-Filterresults: notjunk:1; V01:K0:Nv/u6jm8r30=:zKG5cODMbZCQoMRsbKS45T IaW9aOEvDDebGXLRYRob0i8fM8PM2II0NM/o3tCKIdbEk9FlAseZ7vkUbdwX1OQwuXctdR4Jk GN22xyOLgkl/zP8oT/xP/TbA92aRFEV0RvF/MPug0CD/pMnHM+R+gsWMniI4tm/cI/CtNtKuD 86q1Qtgqe2+uVd5tW+JvZhXO393H1dg6wrbUc8N4mSNPzimXPPBP65uiodQRElkdvcZgyJrOw Tlo+efWSfHHbD1zLZRk5RjnYW1w4WAbShlEwRtHhvmmZIJ4UR3ZhkpJNpABOyHIFBcrhyExa5 C5gZIJvWamtHNH9XTkMWiZUAu6+uYD2MpmICfw0oQDNURCETcE8PaCtLnNtTCHNQi1HDcQE0o J1ZPwnw3Mq6PgilredciRLc3sDFA1xv8y0YMHY4xYdk8MFv/BsaWtY0lbnT20jgPZmNRwjqFy lCbzWrRkThk1STL7MgK+nTDNxA+558ECJCfvkh0PA16NjOEnOA7S4wNxwAnooEqTGUz065ywM gl9VpT69/CY6tYqBlxByjhZl6l6f/lWbo08C/QBGdu7rOwxy7TwgwHWqT2npZMp+rjsZ+ncS3 SJAfpsGNC5OODXjT4NXLOU2C9i5ijGRTDvSTUwte/6UU9z8+cT+aHpcsIi4ac5L6+YRCyhqfB 93Oo8yk453V4ZmrV2ZVfwwwuw9VRf2OMD48sIQZukuCkA0F91ULnr0y+iikFgEQk5YDc= 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 Checking the firmware status from PCIe register only works if the register is available, otherwise we end up with random behavior: drivers/net/wireless/marvell/mwifiex/pcie.c: In function 'mwifiex_pcie_remove': drivers/net/wireless/marvell/mwifiex/pcie.c:585:5: error: 'fw_status' may be used uninitialized in this function [-Werror=maybe-uninitialized] This makes sure we treat the absence of the register as a failure. Fixes: 045f0c1b5e26 ("mwifiex: get rid of global user_rmmod flag") Signed-off-by: Arnd Bergmann --- drivers/net/wireless/marvell/mwifiex/pcie.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 031141663fc0..eebc68caecdd 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -581,6 +581,8 @@ static void mwifiex_pcie_remove(struct pci_dev *pdev) reg = card->pcie.reg; if (reg) ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status); + else + fw_status = -1; if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) { mwifiex_deauthenticate_all(adapter);