From patchwork Tue Oct 9 15:57:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 148505 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp5076380lji; Tue, 9 Oct 2018 08:58:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV63fr/h9v7w8mSq0iYaROBfBQ9OVcAWOyAdUT9cEM7dY+hhcWpVzlYl6xpCknJPDE+vPiDr+ X-Received: by 2002:a62:1b45:: with SMTP id b66-v6mr30673662pfb.94.1539100693083; Tue, 09 Oct 2018 08:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539100693; cv=none; d=google.com; s=arc-20160816; b=MwkvFuCxGUclChT4s26yLO2fIhSSdeCzT3XD8byT5E4jtINAFzEtu9/wiJgNZOX6wE U2sMgdwnTiRPxTPqTyiO4gmSwOz4IKrs2RZlGzffjr77P3PNHLI2/tS/gKxBMFsUKdZG Gykz5uVpYDj+AdxYogVK27QLwFa+nZEZvjz3K1feDjjxxG+8zKJ20etBnJ8BADzYVNRT r5KSekErHxYwecaasMy1mHHeFbZtKFvSva4LgkD2MEwDprsEs27ECMqop6LuhC4yugIJ kyqoTB32bXYEqzRD87xWuygrRtAEHa2XZHSwJL3yyNj96zksfWbjkjywQS1UWHaATnFe tU8w== 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 h1-v6si18330185pgs.493.2018.10.09.08.58.12; Tue, 09 Oct 2018 08:58:13 -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 S1726693AbeJIXPp (ORCPT + 32 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(-) -- 2.18.0 Reviewed-by: Sergey Matyukevich 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);