linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: fix uninitialized variable
@ 2013-03-28  9:11 Vincent
  2013-03-28  9:21 ` Johannes Berg
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent @ 2013-03-28  9:11 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Vincent Stehlé

Fix one code path where chanctx_conf is tested as being non-NULL while it may
be uninitialized.

This fixes the following warning:

  net/mac80211/tx.c: In function ‘ieee80211_subif_start_xmit’:
  net/mac80211/tx.c:1828:27: warning: ‘chanctx_conf’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Vincent Stehlé <vincent.stehle@laposte.net>
Cc: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/tx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 8914d2d..57a5722 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1777,7 +1777,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
 	bool multicast;
 	u32 info_flags = 0;
 	u16 info_id = 0;
-	struct ieee80211_chanctx_conf *chanctx_conf;
+	struct ieee80211_chanctx_conf *chanctx_conf = NULL;
 	struct ieee80211_sub_if_data *ap_sdata;
 	enum ieee80211_band band;
 
-- 
1.7.10.4


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

* Re: [PATCH] mac80211: fix uninitialized variable
  2013-03-28  9:11 [PATCH] mac80211: fix uninitialized variable Vincent
@ 2013-03-28  9:21 ` Johannes Berg
  2013-03-28 11:28   ` Sedat Dilek
  2013-03-30 15:17   ` Vincent
  0 siblings, 2 replies; 8+ messages in thread
From: Johannes Berg @ 2013-03-28  9:21 UTC (permalink / raw)
  To: Vincent; +Cc: linux-wireless

On Thu, 2013-03-28 at 10:11 +0100, Vincent wrote:
> Fix one code path where chanctx_conf is tested as being non-NULL while it may
> be uninitialized.

No, you're wrong, presumably misled by the compiler.

johannes


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

* Re: [PATCH] mac80211: fix uninitialized variable
  2013-03-28  9:21 ` Johannes Berg
@ 2013-03-28 11:28   ` Sedat Dilek
  2013-03-28 11:30     ` Sedat Dilek
  2013-03-30 15:17   ` Vincent
  1 sibling, 1 reply; 8+ messages in thread
From: Sedat Dilek @ 2013-03-28 11:28 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Vincent, linux-wireless, Arnd Bergmann

On Thu, Mar 28, 2013 at 10:21 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Thu, 2013-03-28 at 10:11 +0100, Vincent wrote:
>> Fix one code path where chanctx_conf is tested as being non-NULL while it may
>> be uninitialized.
>
> No, you're wrong, presumably misled by the compiler.
>

Hi,

especially, when you use gcc >=4.7.x compiler with "-Os"
optimize-level you and your binaries/libs get confused.
Arnd Bergmann sent a patch for these "false-positives" (use
"-Wmaybe-uninitialized" as a CFLAGS).
I think this is a good idea.
If more kernel-developers ACK it, it might get mainline :-)?
Gogogo johill (but don't runaway) :-)...

For more details see also gcc-docs on how to suppress errors and treat
them as warnings [1].

Regards,
- Sedat -

[1] http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options

> johannes
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] mac80211: fix uninitialized variable
  2013-03-28 11:28   ` Sedat Dilek
@ 2013-03-28 11:30     ` Sedat Dilek
  2013-03-28 11:32       ` Arnd Bergmann
  0 siblings, 1 reply; 8+ messages in thread
From: Sedat Dilek @ 2013-03-28 11:30 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Vincent, linux-wireless, Arnd Bergmann

On Thu, Mar 28, 2013 at 12:28 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> On Thu, Mar 28, 2013 at 10:21 AM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
>> On Thu, 2013-03-28 at 10:11 +0100, Vincent wrote:
>>> Fix one code path where chanctx_conf is tested as being non-NULL while it may
>>> be uninitialized.
>>
>> No, you're wrong, presumably misled by the compiler.
>>
>
> Hi,
>
> especially, when you use gcc >=4.7.x compiler with "-Os"
> optimize-level you and your binaries/libs get confused.
> Arnd Bergmann sent a patch for these "false-positives" (use
> "-Wmaybe-uninitialized" as a CFLAGS).
> I think this is a good idea.
> If more kernel-developers ACK it, it might get mainline :-)?
> Gogogo johill (but don't runaway) :-)...
>
> For more details see also gcc-docs on how to suppress errors and treat
> them as warnings [1].
>
> Regards,
> - Sedat -
>
> [1] http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options
>

Uuurgh, forgot to add the link for Arnd's patch....

- Sedat -

[2] https://patchwork.kernel.org/patch/2274041/

>> johannes
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] mac80211: fix uninitialized variable
  2013-03-28 11:30     ` Sedat Dilek
@ 2013-03-28 11:32       ` Arnd Bergmann
  0 siblings, 0 replies; 8+ messages in thread
From: Arnd Bergmann @ 2013-03-28 11:32 UTC (permalink / raw)
  To: sedat.dilek; +Cc: Johannes Berg, Vincent, linux-wireless

On Thursday 28 March 2013, Sedat Dilek wrote:
> On Thu, Mar 28, 2013 at 12:28 PM, Sedat Dilek <sedat.dilek@gmail.com> wrote:
> 
> [2] https://patchwork.kernel.org/patch/2274041/
>

There is a newer version with an updated description here:

https://patchwork.kernel.org/patch/2332071/

	Arnd

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

* Re: [PATCH] mac80211: fix uninitialized variable
  2013-03-28  9:21 ` Johannes Berg
  2013-03-28 11:28   ` Sedat Dilek
@ 2013-03-30 15:17   ` Vincent
  1 sibling, 0 replies; 8+ messages in thread
From: Vincent @ 2013-03-30 15:17 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 03/28/2013 10:21 AM, Johannes Berg wrote:
> No, you're wrong, presumably misled by the compiler.

Ah! Right; I see it now. Sorry for the noise.

V.

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

* Re: [PATCH] mac80211: fix uninitialized variable
  2013-10-18 21:57 Michal Kazior
@ 2013-10-21 10:26 ` Johannes Berg
  0 siblings, 0 replies; 8+ messages in thread
From: Johannes Berg @ 2013-10-21 10:26 UTC (permalink / raw)
  To: Michal Kazior; +Cc: linux-wireless

On Fri, 2013-10-18 at 14:57 -0700, Michal Kazior wrote:
> CSA completion could call in a driver
> bss_info_changed() with a garbled `changed` flag
> leading to all sorts of problems.

Applied.

johannes


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

* [PATCH] mac80211: fix uninitialized variable
@ 2013-10-18 21:57 Michal Kazior
  2013-10-21 10:26 ` Johannes Berg
  0 siblings, 1 reply; 8+ messages in thread
From: Michal Kazior @ 2013-10-18 21:57 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Michal Kazior

CSA completion could call in a driver
bss_info_changed() with a garbled `changed` flag
leading to all sorts of problems.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 net/mac80211/cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 629dee7..fd1f6d1 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2860,7 +2860,7 @@ void ieee80211_csa_finalize_work(struct work_struct *work)
 		container_of(work, struct ieee80211_sub_if_data,
 			     csa_finalize_work);
 	struct ieee80211_local *local = sdata->local;
-	int err, changed;
+	int err, changed = 0;
 
 	if (!ieee80211_sdata_running(sdata))
 		return;
-- 
1.8.4.rc3


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

end of thread, other threads:[~2013-10-21 10:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-28  9:11 [PATCH] mac80211: fix uninitialized variable Vincent
2013-03-28  9:21 ` Johannes Berg
2013-03-28 11:28   ` Sedat Dilek
2013-03-28 11:30     ` Sedat Dilek
2013-03-28 11:32       ` Arnd Bergmann
2013-03-30 15:17   ` Vincent
2013-10-18 21:57 Michal Kazior
2013-10-21 10:26 ` Johannes Berg

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).