Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5048724imm; Tue, 9 Oct 2018 08:58:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV61rlDVkbJC361SCRDXIHbka11sAs5QUI9zjOr4C2pPbejd6yMlss2Db3D+4rMUaUFPwthVF X-Received: by 2002:a63:d70c:: with SMTP id d12-v6mr25998607pgg.110.1539100727398; Tue, 09 Oct 2018 08:58:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539100727; cv=none; d=google.com; s=arc-20160816; b=0mL0QYHkTnL79JUDN5ab+gJ0ObTNmXhnryR9dWkEwK2UbDif4tVvtJbYcbYF4utH5P FrKNLOCk2MXo3MQWFTyFVf3FQ6roPDkmR5mk5JnDWt2JpUyTkgKU/O+HiyCNkMdFuL7K 43iHxn/lnfBOgm9srBDmbPexd8q+OiUWJBZv5Nwf9OEy5Dm5a5gBoLbCmWWE8GU5ENSI SFftfYCIwfa9trg0ETC3LF+RYGA3JLLl6TK1WoUID8GYEnakBUXyr69bDQrj7ZMN881C XYrfVWeoTz24f7RinSqeDfbIDz0Gqg1nbqcO4uyiV5IgSrWrzwPwwBMOQ/S6bIYFi1uJ dXEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=zcsCyr8FjQrRQDEV/raV1bc83oXmLgpCtsAGyy0qxa0=; b=tSf2PlJ5+oKjNXn845z9XJNk99eYgXi+fDdR19hRcHp5i/O53smopIReHtae6lTWal okD8pekt5XOPmWDyC+LvIUzHg5EmtrrPUZKZ0EI6KVwHdLFDqnIhgT56sd7YSAAobljw PKhiXiJfV+Ho5aNrtGA4pWsPtmAizVHRPy6rdPPTEYdLHFjZBNnKTnEGMzEQC0/IRBVq MjM7MIKI/YrlZyu85b25m9rFgT2bQTkQyzEd87LG6kOyfMQh8ARSyFozpTczTDYGECyn j59lWliyK+Az2aBTv2T8EBD/5ft9tjH36Vv83RIB60eUDs5umxlXjdydsnFEx7wwQyud WGcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5-v6si20588297pgw.184.2018.10.09.08.58.32; Tue, 09 Oct 2018 08:58:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726616AbeJIXPp (ORCPT + 99 others); Tue, 9 Oct 2018 19:15:45 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:39053 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726418AbeJIXPp (ORCPT ); Tue, 9 Oct 2018 19:15:45 -0400 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MA88C-1fzVLJ32HS-00Bf2S; Tue, 09 Oct 2018 17:57:59 +0200 Received: from wuerfel.lan ([109.193.40.16]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MA88C-1fzVLJ32HS-00Bf2S; Tue, 09 Oct 2018 17:57:59 +0200 From: Arnd Bergmann To: Igor Mitsyanko , Avinash Patil , Sergey Matyukevich , Kalle Valo , "David S. Miller" , Vasily Ulyanov , Andrey Shevchenko Cc: Arnd Bergmann , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] qtnfmac: avoid uninitialized variable access Date: Tue, 9 Oct 2018 17:57:35 +0200 Message-Id: <20181009155757.494212-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:Xax1BOyVDSS/I6d+mxoxQgcdDQz5f+hcrKd/pDuDVWrpsoIp7bq ROicNzkQdIG+sypFTyswVlV4jds99I+dfS27N2vqq9iN+Extm5sNg1q+90HvaR8MT26dnJY EP9orhI5sseScpXK05Ecowgj4/5uOt2jpvBKc/NWpWSYIUm1GqiKp8EB/MCVktBJd81eIto zYVOmLQrFwj7ORhLAynIA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V01:K0:QcTAjmk3cIQ=:2pdHry2WAzRiytm4ZY09Ob e2dZ5NcKYOGaP0bCq07jEJroWBSC5/8k3crJl6Z+4Vqw4zAhk/VeQ9+k25ey8HmhPBRDClon2 UxEuEgNYV4NU+UVElmoy4oZ3NU3Gr4jnh46RHfu/YkuWVmFBw/GeFWhL9xc93xJvYxTJKtC18 SbsrMFSp+083AWnlBDcpSYNmUUD5b7WYmIA0/kJFRAXoGkn5gYiqZZPF+uoIADek7GdK9ZK/x 6cw3s8WwlvGbf9UsrcLoBrMn4yaE7bHzrhkU6zsD/fYAKluaoJxcGeZDY/ocpnhG59kbaqeNV xNTYDJPGDKfzt2vaZ72tJM7Zhb5saBFoJ6w6TMj9QPIIxP4F1OiUtq77tZGRmsHIAAYiNN/95 q9wBp/nZ/uykld45UY53Fvzl0SwZDpHanFwBOzswSA2a2e+xUuqr5XqM0j8RDSu6uHXLiLxpm GEYihj2aEqMXQqb2/Mz8902mDzoqqScF9xImh9cEyVp9VS53/nn/zkp+SNSFbq3aiHKGpvupg kefD25F7gDcY3BbqUIJ8HboW20fuzY1H5/C/M/Bi8/Qw+pXytK2lkIC8XMuL3vmWR9+wXjqP9 HpsQk8pUYJZWituCHA3oQd/jWmvZd8YFHZu4wdSBDL2abZlH+JgqhDIP3+cjJHWKL0u5WunOa CVHx4yajpzLJYrWH2sA6BUbdMBaE+vyrIBz9PZg451c2PPZR4mnJ5CqfNpW5hLk0T/Ec= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When qtnf_trans_send_cmd_with_resp() fails, we have not yet initialized 'resp', as pointed out by a valid gcc warning: drivers/net/wireless/quantenna/qtnfmac/commands.c: In function 'qtnf_cmd_send_with_reply': drivers/net/wireless/quantenna/qtnfmac/commands.c:133:54: error: 'resp' may be used uninitialized in this function [-Werror=maybe-uninitialized] Since 'resp_skb' is also not set here, we can skip all further processing and just print the warning and return the failure code. Fixes: c6ed298ffe09 ("qtnfmac: cleanup and unify command error handling") Signed-off-by: Arnd Bergmann --- drivers/net/wireless/quantenna/qtnfmac/commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c index bfdc1ad30c13..9b211459684a 100644 --- a/drivers/net/wireless/quantenna/qtnfmac/commands.c +++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c @@ -111,7 +111,7 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus, ret = qtnf_trans_send_cmd_with_resp(bus, cmd_skb, &resp_skb); if (ret) - goto out; + goto out_noresp; resp = (const struct qlink_resp *)resp_skb->data; ret = qtnf_cmd_check_reply_header(resp, cmd_id, mac_id, vif_id, @@ -132,6 +132,7 @@ static int qtnf_cmd_send_with_reply(struct qtnf_bus *bus, if (!ret && resp) return qtnf_cmd_resp_result_decode(le16_to_cpu(resp->result)); +out_noresp: pr_warn("VIF%u.%u: cmd 0x%.4X failed: %d\n", mac_id, vif_id, le16_to_cpu(cmd->cmd_id), ret); -- 2.18.0