linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix warning in ieee80211_probe_client
@ 2011-11-11 18:32 John W. Linville
  2011-11-11 19:03 ` Larry Finger
  2011-11-11 19:22 ` [PATCH] " Johannes Berg
  0 siblings, 2 replies; 6+ messages in thread
From: John W. Linville @ 2011-11-11 18:32 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, John W. Linville

  CC [M]  net/mac80211/cfg.o
net/mac80211/cfg.c: In function ‘ieee80211_probe_client’:
net/mac80211/cfg.c:2567:7: warning: ‘qos’ may be used uninitialized in this function

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 net/mac80211/cfg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index c2416fb..1d82d2b 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2564,7 +2564,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
 	struct sk_buff *skb;
 	int size = sizeof(*nullfunc);
 	__le16 fc;
-	bool qos;
+	bool qos = NULL;
 	struct ieee80211_tx_info *info;
 	struct sta_info *sta;
 
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211: fix warning in ieee80211_probe_client
  2011-11-11 18:32 [PATCH] mac80211: fix warning in ieee80211_probe_client John W. Linville
@ 2011-11-11 19:03 ` Larry Finger
  2011-11-11 19:16   ` John W. Linville
  2011-11-11 19:24   ` [PATCH v2] " John W. Linville
  2011-11-11 19:22 ` [PATCH] " Johannes Berg
  1 sibling, 2 replies; 6+ messages in thread
From: Larry Finger @ 2011-11-11 19:03 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Johannes Berg

On 11/11/2011 12:32 PM, John W. Linville wrote:
>    CC [M]  net/mac80211/cfg.o
> net/mac80211/cfg.c: In function ‘ieee80211_probe_client’:
> net/mac80211/cfg.c:2567:7: warning: ‘qos’ may be used uninitialized in this function
>
> Signed-off-by: John W. Linville<linville@tuxdriver.com>
> ---
>   net/mac80211/cfg.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index c2416fb..1d82d2b 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -2564,7 +2564,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
>   	struct sk_buff *skb;
>   	int size = sizeof(*nullfunc);
>   	__le16 fc;
> -	bool qos;
> +	bool qos = NULL;
>   	struct ieee80211_tx_info *info;
>   	struct sta_info *sta;

Shouldn't the initialization for a bool be "false"? Doesn't checkpatch.pl 
complain about that? I know it does if you try to initialize a pointer to 0 
rather than NULL.

Larry


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211: fix warning in ieee80211_probe_client
  2011-11-11 19:03 ` Larry Finger
@ 2011-11-11 19:16   ` John W. Linville
  2011-11-11 19:24   ` [PATCH v2] " John W. Linville
  1 sibling, 0 replies; 6+ messages in thread
From: John W. Linville @ 2011-11-11 19:16 UTC (permalink / raw)
  To: Larry Finger; +Cc: linux-wireless, Johannes Berg

On Fri, Nov 11, 2011 at 01:03:31PM -0600, Larry Finger wrote:
> On 11/11/2011 12:32 PM, John W. Linville wrote:
> >   CC [M]  net/mac80211/cfg.o
> >net/mac80211/cfg.c: In function ‘ieee80211_probe_client’:
> >net/mac80211/cfg.c:2567:7: warning: ‘qos’ may be used uninitialized in this function
> >
> >Signed-off-by: John W. Linville<linville@tuxdriver.com>
> >---
> >  net/mac80211/cfg.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> >diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> >index c2416fb..1d82d2b 100644
> >--- a/net/mac80211/cfg.c
> >+++ b/net/mac80211/cfg.c
> >@@ -2564,7 +2564,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
> >  	struct sk_buff *skb;
> >  	int size = sizeof(*nullfunc);
> >  	__le16 fc;
> >-	bool qos;
> >+	bool qos = NULL;
> >  	struct ieee80211_tx_info *info;
> >  	struct sta_info *sta;
> 
> Shouldn't the initialization for a bool be "false"? Doesn't
> checkpatch.pl complain about that? I know it does if you try to
> initialize a pointer to 0 rather than NULL.

That's why we post patches to the list. :-)

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211: fix warning in ieee80211_probe_client
  2011-11-11 18:32 [PATCH] mac80211: fix warning in ieee80211_probe_client John W. Linville
  2011-11-11 19:03 ` Larry Finger
@ 2011-11-11 19:22 ` Johannes Berg
  2011-11-11 19:29   ` John W. Linville
  1 sibling, 1 reply; 6+ messages in thread
From: Johannes Berg @ 2011-11-11 19:22 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

On Fri, 2011-11-11 at 13:32 -0500, John W. Linville wrote:
> CC [M]  net/mac80211/cfg.o
> net/mac80211/cfg.c: In function ‘ieee80211_probe_client’:
> net/mac80211/cfg.c:2567:7: warning: ‘qos’ may be used uninitialized in this function

Hm, you need a better compiler ;-) How about below instead (keeping the
subject)? I kinda don't like just initialising the variable "randomly".

johannes


From: Johannes Berg <johannes.berg@intel.com>

The warning is spurious -- if !sta we always exit without using the
unassigned qos variable, and if we do find the sta we assign it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---

--- wireless-testing.orig/net/mac80211/cfg.c	2011-11-10 09:29:29.000000000 +0100
+++ wireless-testing/net/mac80211/cfg.c	2011-11-11 20:21:08.000000000 +0100
@@ -2530,12 +2530,13 @@ static int ieee80211_probe_client(struct
 
 	rcu_read_lock();
 	sta = sta_info_get(sdata, peer);
-	if (sta)
+	if (sta) {
 		qos = test_sta_flag(sta, WLAN_STA_WME);
-	rcu_read_unlock();
-
-	if (!sta)
+		rcu_read_unlock();
+	} else {
+		rcu_read_unlock();
 		return -ENOLINK;
+	}
 
 	if (qos) {
 		fc = cpu_to_le16(IEEE80211_FTYPE_DATA |



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] mac80211: fix warning in ieee80211_probe_client
  2011-11-11 19:03 ` Larry Finger
  2011-11-11 19:16   ` John W. Linville
@ 2011-11-11 19:24   ` John W. Linville
  1 sibling, 0 replies; 6+ messages in thread
From: John W. Linville @ 2011-11-11 19:24 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Larry Finger, John W. Linville

  CC [M]  net/mac80211/cfg.o
net/mac80211/cfg.c: In function ‘ieee80211_probe_client’:
net/mac80211/cfg.c:2567:7: warning: ‘qos’ may be used uninitialized in this function

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
v2 -- use "false" instead of "NULL" for initializing bool -- duh!

 net/mac80211/cfg.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index c2416fb..a097d60 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2564,7 +2564,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
 	struct sk_buff *skb;
 	int size = sizeof(*nullfunc);
 	__le16 fc;
-	bool qos;
+	bool qos = false;
 	struct ieee80211_tx_info *info;
 	struct sta_info *sta;
 
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mac80211: fix warning in ieee80211_probe_client
  2011-11-11 19:22 ` [PATCH] " Johannes Berg
@ 2011-11-11 19:29   ` John W. Linville
  0 siblings, 0 replies; 6+ messages in thread
From: John W. Linville @ 2011-11-11 19:29 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On Fri, Nov 11, 2011 at 08:22:30PM +0100, Johannes Berg wrote:
> On Fri, 2011-11-11 at 13:32 -0500, John W. Linville wrote:
> > CC [M]  net/mac80211/cfg.o
> > net/mac80211/cfg.c: In function ‘ieee80211_probe_client’:
> > net/mac80211/cfg.c:2567:7: warning: ‘qos’ may be used uninitialized in this function
> 
> Hm, you need a better compiler ;-) How about below instead (keeping the
> subject)? I kinda don't like just initialising the variable "randomly".
> 
> johannes
> 
> 
> From: Johannes Berg <johannes.berg@intel.com>
> 
> The warning is spurious -- if !sta we always exit without using the
> unassigned qos variable, and if we do find the sta we assign it.
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Works for me...

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-11-11 19:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-11 18:32 [PATCH] mac80211: fix warning in ieee80211_probe_client John W. Linville
2011-11-11 19:03 ` Larry Finger
2011-11-11 19:16   ` John W. Linville
2011-11-11 19:24   ` [PATCH v2] " John W. Linville
2011-11-11 19:22 ` [PATCH] " Johannes Berg
2011-11-11 19:29   ` John W. Linville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).