From patchwork Tue Jun 27 15:24:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9812609 X-Patchwork-Delegate: luca@coelho.fi 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 ABA18603D7 for ; Tue, 27 Jun 2017 15:27:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9ECF028681 for ; Tue, 27 Jun 2017 15:27:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9391028687; Tue, 27 Jun 2017 15:27:25 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 5241028681 for ; Tue, 27 Jun 2017 15:27:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751508AbdF0P1P (ORCPT ); Tue, 27 Jun 2017 11:27:15 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:56957 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753485AbdF0PZh (ORCPT ); Tue, 27 Jun 2017 11:25:37 -0400 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0MHMsV-1dTx6t140h-00E6dh; Tue, 27 Jun 2017 17:25:00 +0200 From: Arnd Bergmann To: Johannes Berg , Luca Coelho Cc: Arnd Bergmann , Emmanuel Grumbach , Intel Linux Wireless , Kalle Valo , Sara Sharon , Golan Ben-Ami , Liad Kaufman , Haim Dreyfuss , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iwlwifi: mvm: fix iwl_mvm_sar_find_wifi_pkg corner case Date: Tue, 27 Jun 2017 17:24:17 +0200 Message-Id: <20170627152458.1103403-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:gs8m2d/0MaTjGpZoOiWdioqX/43KmBFLDha3d1e/VdjccYP3WJ2 3bl9yvmtC6+Riw38jSwCHw58sjwgAfQtj+2Xj1vx427W9FpFq+JzoLrEZVtHZhkz/QyQQwm IifppaAK0Rh3c/dkuT5bU5G1n2T/vehMQhP50qU8fU1dy5CX4/9AaULRAKs2/qhWr4b/rcy /VoRMS4IoDcDY19+ls75w== X-UI-Out-Filterresults: notjunk:1; V01:K0:cCAFmOSnhao=:7+CF/NcWwR5VOjnD0/tJsN yDkcHbgg0LXu9q0xka07OwcpvFN7TKE+EA8dPTrzNFpcyQU5UJT9Tdym9xAhdJa94jWWHGpVm pacC6rlLgd/D6oe8nklrlwjNRl7yPLHp/rhVIH886vOigG5EadorXLKhr5vYhYyoxS5Bs2xtF 8jvgP0AA+nawYDFyE7tRqa262hj2CL3QCwu3RiUAuqp3qZdD5lAN/yJ2kQqCwPYzQZkxFuzE/ DDknWPyHNHJxnj6s4ilZhLxOESBb0TLElWDLfc9HJjjn0yO+3Ai+W8QuoFlMy9FFd22aWXHJi IZSCsWzGwgNIRquz5S4eilTqVKIIpcLyfAp0fK0MaSudHhHyNSvTZurObI0H20cLIcvu3lMyK ldxBHiYwvj+MNqyTOSyYkgTVlXogb+WYuF3wo3ybQ+lr7XXotcZOvjJh1VV4CGcPG05uncavc fdZMTQkpbQE+6Uscn2HGQY+wwHqlLpgi5jFszFpa5zyxBics3Dv7aM795WNc5KE39pZ4WVQrg 9CXlOj4MmwJLY5eijJ/riUXghqq2cg8i5LOzK0AggAHqUgRj7Klr0jeoAQKfMxu+Eg7DTOTwC aS5BRmDLQsn6JqhR3UIW1ybwgtUC0mKVDewvnTYLTQSM+pAOGRjIvrR1VlIU+afJW4Do83W4k v6DlCd9Lf/1PJ02uFlkpuur907G1vTz57reA+37aWQ++4M8xdzccwEtMUugCvWSooNE0= 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 gcc warns about what it thinks is an uninitialized variable access: drivers/net/wireless/intel/iwlwifi/mvm/fw.c: In function 'iwl_mvm_sar_find_wifi_pkg.isra.14': drivers/net/wireless/intel/iwlwifi/mvm/fw.c:1102:5: error: 'wifi_pkg' may be used uninitialized in this function [-Werror=maybe-uninitialized] That problem cannot really happen, as we check data->package.count to ensure that the loop is entered at least once. However, something that can indeed happen is returning an incorrect wifi_pkg pointer in case none of the elements are what we are looking for. This modifies the loop again, to only return a correct object, and to shut up that warning. Fixes: c386dacb4ed6 ("iwlwifi: mvm: refactor SAR init to prepare for dynamic SAR") Signed-off-by: Arnd Bergmann --- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index 24cc406d87ef..730c7f68c0b3 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -1094,14 +1094,12 @@ static union acpi_object *iwl_mvm_sar_find_wifi_pkg(struct iwl_mvm *mvm, domain = &wifi_pkg->package.elements[0]; if (domain->type == ACPI_TYPE_INTEGER && domain->integer.value == ACPI_WIFI_DOMAIN) - break; - - wifi_pkg = NULL; + goto found; } - if (!wifi_pkg) - return ERR_PTR(-ENOENT); + return ERR_PTR(-ENOENT); +found: return wifi_pkg; }