2011-11-09 22:00:11

by John W. Linville

[permalink] [raw]
Subject: New wireless-testing has grown some warnings -- please fix ASAP!

commit befdbc51cc69c01cd412ad2429960b9c3042f97c is the current
wireless-testing head.

This iteration of wireless-testing seems to have grown some
warnings. Some of them come from a new __must_check annotation of
cfg80211_inform_bss, while others are simply unused or uninitialized
variables. In any case, I would prefer not to see them.

Please check the wireless-testing build and attempt to squash any
warnings that can be reasonably squashed. Those who do not do so
will be subject to irritated sighs over IRC, drunken emails about
my new DVD rental service, and accusations of making unwanted sexual
advances toward me. You've been warned.

John

---

CC [M] net/wireless/nl80211.o
net/wireless/nl80211.c: In function ‘nl80211_tx_mgmt’:
net/wireless/nl80211.c:5286:8: warning: ‘hdr’ may be used uninitialized in this function

CC [M] drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.o
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c: In function ‘wl_inform_ibss’:
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c:2152:21: warning: ignoring return value of ‘cfg80211_inform_bss’, declared with attribute warn_unused_result

CC [M] drivers/net/wireless/libertas/cfg.o
drivers/net/wireless/libertas/cfg.c: In function ‘lbs_ret_scan’:
drivers/net/wireless/libertas/cfg.c:636:24: warning: ignoring return value of ‘cfg80211_inform_bss’, declared with attribute warn_unused_result
drivers/net/wireless/libertas/cfg.c: In function ‘lbs_join_post’:
drivers/net/wireless/libertas/cfg.c:1766:21: warning: ignoring return value of ‘cfg80211_inform_bss’, declared with attribute warn_unused_result

CC [M] drivers/net/wireless/mwifiex/cfg80211.o
drivers/net/wireless/mwifiex/cfg80211.c: In function ‘mwifiex_cfg80211_inform_ibss_bss’:
drivers/net/wireless/mwifiex/cfg80211.c:803:21: warning: ignoring return value of ‘cfg80211_inform_bss’, declared with attribute warn_unused_result

--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.


2011-11-09 22:12:49

by Johannes Berg

[permalink] [raw]
Subject: Re: New wireless-testing has grown some warnings -- please fix ASAP!

On Wed, 2011-11-09 at 16:50 -0500, John W. Linville wrote:

> CC [M] net/wireless/nl80211.o
> net/wireless/nl80211.c: In function ‘nl80211_tx_mgmt’:
> net/wireless/nl80211.c:5286:8: warning: ‘hdr’ may be used uninitialized in this function

Hm, my compiler is smarter than yours ;-)

Not quite sure how to fix this best, I'll figure out something. Thanks
for the heads-up.

johannes



2011-11-09 22:55:50

by Bing Zhao

[permalink] [raw]
Subject: RE: New wireless-testing has grown some warnings -- please fix ASAP!

SGkgSm9obiwNCg0KPiAgIENDIFtNXSAgZHJpdmVycy9uZXQvd2lyZWxlc3MvbXdpZmlleC9jZmc4
MDIxMS5vDQo+IGRyaXZlcnMvbmV0L3dpcmVsZXNzL213aWZpZXgvY2ZnODAyMTEuYzogSW4gZnVu
Y3Rpb24g4oCYbXdpZmlleF9jZmc4MDIxMV9pbmZvcm1faWJzc19ic3PigJk6DQo+IGRyaXZlcnMv
bmV0L3dpcmVsZXNzL213aWZpZXgvY2ZnODAyMTEuYzo4MDM6MjE6IHdhcm5pbmc6IGlnbm9yaW5n
IHJldHVybiB2YWx1ZSBvZg0KPiDigJhjZmc4MDIxMV9pbmZvcm1fYnNz4oCZLCBkZWNsYXJlZCB3
aXRoIGF0dHJpYnV0ZSB3YXJuX3VudXNlZF9yZXN1bHQNCg0KVGhlIFtQQVRDSCA3LzddIEkgc2Vu
dCB5ZXN0ZXJkYXkgKGNvcGllZCAmIHBhc3RlZCBiZWxvdykgZml4ZWQgdGhlIHdhcm5pbmcgaW4g
bXdpZmlleC4NCg0KVGhhbmtzLA0KQmluZw0KDQotLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0K
RnJvbTogQmluZyBaaGFvIFttYWlsdG86YnpoYW9AbWFydmVsbC5jb21dIA0KU2VudDogTW9uZGF5
LCBOb3ZlbWJlciAwNywgMjAxMSA5OjQxIFBNDQpUbzogbGludXgtd2lyZWxlc3NAdmdlci5rZXJu
ZWwub3JnDQpDYzogSm9obiBXLiB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2LT5j
dXJyX2Jzc19wYXJhbXMuYnNzX2Rlc2NyaXB0b3INCi0tIA0KMS43LjAuMg0K

2011-11-10 08:44:52

by Johannes Berg

[permalink] [raw]
Subject: [PATCH] nl80211: fix compiler warning

From: Johannes Berg <[email protected]>

John reported the following warning:

net/wireless/nl80211.c: In function ‘nl80211_tx_mgmt’:
net/wireless/nl80211.c:5286:8: warning: ‘hdr’ may be used uninitialized in this function

Evidently, his version of gcc isn't able to see that
when "msg" is initialized, "hdr" must also be. My
gcc, 4.6.1, can actually see that and doesn't warn.
Simply initialize the variable to NULL. That means
if the compiler was ever right we'll crash though so
isn't really optimal since it may hide warnings from
the compiler when somebody modifies this code in the
future.

Reported-by: John Linville <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
---
net/wireless/nl80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/net/wireless/nl80211.c 2011-11-10 09:36:08.000000000 +0100
+++ b/net/wireless/nl80211.c 2011-11-10 09:42:15.000000000 +0100
@@ -5283,7 +5283,7 @@ static int nl80211_tx_mgmt(struct sk_buf
bool channel_type_valid = false;
u32 freq;
int err;
- void *hdr;
+ void *hdr = NULL;
u64 cookie;
struct sk_buff *msg = NULL;
unsigned int wait = 0;



2011-11-10 15:15:19

by John W. Linville

[permalink] [raw]
Subject: Re: New wireless-testing has grown some warnings -- please fix ASAP!

On Wed, Nov 09, 2011 at 05:58:10PM -0600, Larry Finger wrote:
> On 11/09/2011 03:50 PM, John W. Linville wrote:
> >commit befdbc51cc69c01cd412ad2429960b9c3042f97c is the current
> >wireless-testing head.
> >
> >This iteration of wireless-testing seems to have grown some
> >warnings. Some of them come from a new __must_check annotation of
> >cfg80211_inform_bss, while others are simply unused or uninitialized
> >variables. In any case, I would prefer not to see them.
> >
> >Please check the wireless-testing build and attempt to squash any
> >warnings that can be reasonably squashed. Those who do not do so
> >will be subject to irritated sighs over IRC, drunken emails about
> >my new DVD rental service, and accusations of making unwanted sexual
> >advances toward me. You've been warned.
> >
> >John
>
> For the record, what compiler are you using?

[linville-8530p.local]:> gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared
--enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile
--enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC)

--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2011-11-09 23:58:13

by Larry Finger

[permalink] [raw]
Subject: Re: New wireless-testing has grown some warnings -- please fix ASAP!

On 11/09/2011 03:50 PM, John W. Linville wrote:
> commit befdbc51cc69c01cd412ad2429960b9c3042f97c is the current
> wireless-testing head.
>
> This iteration of wireless-testing seems to have grown some
> warnings. Some of them come from a new __must_check annotation of
> cfg80211_inform_bss, while others are simply unused or uninitialized
> variables. In any case, I would prefer not to see them.
>
> Please check the wireless-testing build and attempt to squash any
> warnings that can be reasonably squashed. Those who do not do so
> will be subject to irritated sighs over IRC, drunken emails about
> my new DVD rental service, and accusations of making unwanted sexual
> advances toward me. You've been warned.
>
> John

For the record, what compiler are you using?

Larry