Message ID | 20230709133154.26206-1-rdunlap@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4456196vqx; Sun, 9 Jul 2023 06:53:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlFpjJsWLurP54NjQ4kvOK4GsWoitsHvBhVvP3gS2rfM4akLcSqGz4Xt5jpfXNj4U609+rXJ X-Received: by 2002:a17:906:57da:b0:98f:ab82:8893 with SMTP id u26-20020a17090657da00b0098fab828893mr7947944ejr.73.1688910828036; Sun, 09 Jul 2023 06:53:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688910828; cv=none; d=google.com; s=arc-20160816; b=NhhjL1XNNzEh5+yveFPnGTCnmmeTHgurlZkQBkgTJMDg6icclNjipNcvzofbDOK1NB eDsURG1GiN2p8Tob96A79zpvX0BeHLQ3rx75cJcvfJC7Yudgja9CTkUQESx3+bLoyS8X dpcGfd9yRPKulb8haLtB+SopxT8WX4iqwztJN0OSeRRxHVqNy8b+7In+P4JDj/BtZTXz /myvVYsQVqvq/Td0Oh4XfXH/HujUmxMFIm5oECC7LA8W7LLrkS0ykSlTX3SrvKyKbpNS H44OvEkJo+9jpx6QLR8YsqzzvfDsuqMG7I8U2Ww/IFo2wxNtAUP/h04TP2pKpyUlAgPn 52zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=smZyFzpjsdq6rsc/GJeO6fE5WeiI+FBLfufH8jJvwzo=; fh=Iys+nkWWqX+A+Bimo3OvGc3nB10GGYX7eMFwE47aCo0=; b=YTOZ5nSIRGWQml5tmf16pgu7wjPKPvoV8BbFl2IBJmNZZnD7ELNlv8AfpzZUn9LCaK BaQC3vhEMvrxkpSWXNEffrWBJPYd9xH+DejUDUrB9/TvUx0OxQf94YqQBAQXAedqEpqe LFqaafJ8ZZSgNCdQxt1OtEs+/G/3yWzWtrNdnL6noY+jzGbPzG2qKcbIt+vTCE0wcIkq Uzz+HkVAWFjDsgdSuhW57PjFqKh6geWonn2XKhlTl/kdyQCKiO8+8ZGRNo+xcEC+NgTu zF1kGd2dfte/IigMfaOxQt59xw1yMXePc431zv0nt7NP4aQwEY21KkuYykm78baJ4fhd 9FAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=WoGea24O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t25-20020a170906179900b0098885a739f2si5411600eje.657.2023.07.09.06.53.24; Sun, 09 Jul 2023 06:53:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=WoGea24O; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232147AbjGINb6 (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Sun, 9 Jul 2023 09:31:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjGINb5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 9 Jul 2023 09:31:57 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04120BB; Sun, 9 Jul 2023 06:31:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=smZyFzpjsdq6rsc/GJeO6fE5WeiI+FBLfufH8jJvwzo=; b=WoGea24O0l+2MCc8rj2P4bppsS /u74cxQpodZU07LC0VO6wfWwCVkLSZgZX3jrXIb07XOtPWc7Ja0MD8OznnL4xXCTvx9LblEP7f2Pj u+4yZa3DCRPqy43UmT6dO77OEUk+EVDWsFlxkwQ4USnV5JdmGPP+1VZoqpBuQQ5V19K34nTvDKDIV BUmFONRH0O/f4AFZBvdzHV6cIYj5AF8jZC0V2wsTp6sAFLyYWQTRIXwCNm8ioMV6v2TRjn2n+x0hu Q6Tzqp3FaF9lXm2d/360UCDzRMyvv2ypbSiJ4IijSwpTfsYKdlC2v4Rj8Kz8GcjpqglsDFiW8RUaD uZXjpYuA==; Received: from [2601:1c2:980:9ec0::2764] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qIUW3-009AOV-1C; Sun, 09 Jul 2023 13:31:55 +0000 From: Randy Dunlap <rdunlap@infradead.org> To: linux-kernel@vger.kernel.org Cc: Randy Dunlap <rdunlap@infradead.org>, Geert Uytterhoeven <geert@linux-m68k.org>, Kalle Valo <kvalo@kernel.org>, linux-wireless@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org Subject: [PATCH net] wifi: airo: avoid uninitialized warning in airo_get_rate() Date: Sun, 9 Jul 2023 06:31:54 -0700 Message-ID: <20230709133154.26206-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770951359933490356?= X-GMAIL-MSGID: =?utf-8?q?1770951359933490356?= |
Series |
[net] wifi: airo: avoid uninitialized warning in airo_get_rate()
|
|
Commit Message
Randy Dunlap
July 9, 2023, 1:31 p.m. UTC
Quieten a gcc (11.3.0) build error or warning by checking the function
call status and returning -EBUSY if the function call failed.
This is similar to what several other wireless drivers do for the
SIOCGIWRATE ioctl call when there is a locking problem.
drivers/net/wireless/cisco/airo.c: error: 'status_rid.currentXmitRate' is used uninitialized [-Werror=uninitialized]
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: lore.kernel.org/r/39abf2c7-24a-f167-91da-ed4c5435d1c4@linux-m68k.org
Cc: Kalle Valo <kvalo@kernel.org>
Cc: linux-wireless@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org
---
drivers/net/wireless/cisco/airo.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On Sun, Jul 09, 2023 at 06:31:54AM -0700, Randy Dunlap wrote: > Quieten a gcc (11.3.0) build error or warning by checking the function > call status and returning -EBUSY if the function call failed. > This is similar to what several other wireless drivers do for the > SIOCGIWRATE ioctl call when there is a locking problem. > > drivers/net/wireless/cisco/airo.c: error: 'status_rid.currentXmitRate' is used uninitialized [-Werror=uninitialized] Hi Randy, There seem to be other calls to readStatusRid() in the same file with similar properties. Perhaps it would be best to fix them too? > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Randy Dunlap <rdunlap@infradead.org> > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> > Link: lore.kernel.org/r/39abf2c7-24a-f167-91da-ed4c5435d1c4@linux-m68k.org > Cc: Kalle Valo <kvalo@kernel.org> > Cc: linux-wireless@vger.kernel.org > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Eric Dumazet <edumazet@google.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Paolo Abeni <pabeni@redhat.com> > Cc: netdev@vger.kernel.org > --- > drivers/net/wireless/cisco/airo.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff -- a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c > --- a/drivers/net/wireless/cisco/airo.c > +++ b/drivers/net/wireless/cisco/airo.c > @@ -6157,8 +6157,11 @@ static int airo_get_rate(struct net_devi > struct iw_param *vwrq = &wrqu->bitrate; > struct airo_info *local = dev->ml_priv; > StatusRid status_rid; /* Card status info */ > + int ret; > > - readStatusRid(local, &status_rid, 1); > + ret = readStatusRid(local, &status_rid, 1); > + if (ret) > + return -EBUSY; > > vwrq->value = le16_to_cpu(status_rid.currentXmitRate) * 500000; > /* If more than one rate, set auto */ >
Hi Simon, On 7/11/23 10:25, Simon Horman wrote: > On Sun, Jul 09, 2023 at 06:31:54AM -0700, Randy Dunlap wrote: >> Quieten a gcc (11.3.0) build error or warning by checking the function >> call status and returning -EBUSY if the function call failed. >> This is similar to what several other wireless drivers do for the >> SIOCGIWRATE ioctl call when there is a locking problem. >> >> drivers/net/wireless/cisco/airo.c: error: 'status_rid.currentXmitRate' is used uninitialized [-Werror=uninitialized] > > Hi Randy, > > There seem to be other calls to readStatusRid() in the same file > with similar properties. Perhaps it would be best to fix them too? > Yes, there are 40+ calls that could have problems. Please see this thread: https://lore.kernel.org/all/2f6ffd1c-a756-b7b8-bba4-77c2308f26b9@infradead.org/ This is an attempt to shut up the build error/warning, which only occurs after this one function call. For such an old driver/hardware, I don't plan to do massive surgery to it. >> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") >> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> >> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> >> Link: lore.kernel.org/r/39abf2c7-24a-f167-91da-ed4c5435d1c4@linux-m68k.org >> Cc: Kalle Valo <kvalo@kernel.org> >> Cc: linux-wireless@vger.kernel.org >> Cc: "David S. Miller" <davem@davemloft.net> >> Cc: Eric Dumazet <edumazet@google.com> >> Cc: Jakub Kicinski <kuba@kernel.org> >> Cc: Paolo Abeni <pabeni@redhat.com> >> Cc: netdev@vger.kernel.org >> --- >> drivers/net/wireless/cisco/airo.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff -- a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c >> --- a/drivers/net/wireless/cisco/airo.c >> +++ b/drivers/net/wireless/cisco/airo.c >> @@ -6157,8 +6157,11 @@ static int airo_get_rate(struct net_devi >> struct iw_param *vwrq = &wrqu->bitrate; >> struct airo_info *local = dev->ml_priv; >> StatusRid status_rid; /* Card status info */ >> + int ret; >> >> - readStatusRid(local, &status_rid, 1); >> + ret = readStatusRid(local, &status_rid, 1); >> + if (ret) >> + return -EBUSY; >> >> vwrq->value = le16_to_cpu(status_rid.currentXmitRate) * 500000; >> /* If more than one rate, set auto */ >>
Hello: This patch was applied to netdev/net.git (main) by Jakub Kicinski <kuba@kernel.org>: On Sun, 9 Jul 2023 06:31:54 -0700 you wrote: > Quieten a gcc (11.3.0) build error or warning by checking the function > call status and returning -EBUSY if the function call failed. > This is similar to what several other wireless drivers do for the > SIOCGIWRATE ioctl call when there is a locking problem. > > drivers/net/wireless/cisco/airo.c: error: 'status_rid.currentXmitRate' is used uninitialized [-Werror=uninitialized] > > [...] Here is the summary with links: - [net] wifi: airo: avoid uninitialized warning in airo_get_rate() https://git.kernel.org/netdev/net/c/9373771aaed1 You are awesome, thank you!
On Tue, Jul 11, 2023 at 02:07:57PM -0700, Randy Dunlap wrote: > Hi Simon, > > On 7/11/23 10:25, Simon Horman wrote: > > On Sun, Jul 09, 2023 at 06:31:54AM -0700, Randy Dunlap wrote: > >> Quieten a gcc (11.3.0) build error or warning by checking the function > >> call status and returning -EBUSY if the function call failed. > >> This is similar to what several other wireless drivers do for the > >> SIOCGIWRATE ioctl call when there is a locking problem. > >> > >> drivers/net/wireless/cisco/airo.c: error: 'status_rid.currentXmitRate' is used uninitialized [-Werror=uninitialized] > > > > Hi Randy, > > > > There seem to be other calls to readStatusRid() in the same file > > with similar properties. Perhaps it would be best to fix them too? > > > > Yes, there are 40+ calls that could have problems. > Please see this thread: > https://lore.kernel.org/all/2f6ffd1c-a756-b7b8-bba4-77c2308f26b9@infradead.org/ > > This is an attempt to shut up the build error/warning, which only occurs after > this one function call. > > For such an old driver/hardware, I don't plan to do massive surgery > to it. Thanks Randy, given the circumstances I agree this is a reasonable approach. Reviewed-by: Simon Horman <simon.horman@corigine.com>
diff -- a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c @@ -6157,8 +6157,11 @@ static int airo_get_rate(struct net_devi struct iw_param *vwrq = &wrqu->bitrate; struct airo_info *local = dev->ml_priv; StatusRid status_rid; /* Card status info */ + int ret; - readStatusRid(local, &status_rid, 1); + ret = readStatusRid(local, &status_rid, 1); + if (ret) + return -EBUSY; vwrq->value = le16_to_cpu(status_rid.currentXmitRate) * 500000; /* If more than one rate, set auto */