linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* b43{,legacy}_start can return uninitialized value
@ 2007-10-14 17:51 Adrian Bunk
  2007-10-15 11:34 ` [-mm Patch] drivers/net/wireless/b43/main.c: fix an uninitialized variable WANG Cong
  2007-10-15 11:59 ` [-mm Patch] drivers/net/wireless/b43legacy/main.c: initialize the correct return value WANG Cong
  0 siblings, 2 replies; 6+ messages in thread
From: Adrian Bunk @ 2007-10-14 17:51 UTC (permalink / raw)
  To: mb, st3, Larry.Finger; +Cc: linux-wireless, linux-kernel

drivers/net/wireless/b43/main.c:b43_start() consists of the
following code:

<--  snip -->

static int b43_start(struct ieee80211_hw *hw)
{
        struct b43_wl *wl = hw_to_b43_wl(hw);
        struct b43_wldev *dev = wl->current_dev;
        int did_init = 0;
        int err;

        mutex_lock(&wl->mutex);

        if (b43_status(dev) < B43_STAT_INITIALIZED) {
                err = b43_wireless_core_init(dev);
                if (err)
                        goto out_mutex_unlock;
                did_init = 1;
        }

        if (b43_status(dev) < B43_STAT_STARTED) {
                err = b43_wireless_core_start(dev);
                if (err) {
                        if (did_init)
                                b43_wireless_core_exit(dev);
                        goto out_mutex_unlock;
                }
        }

 out_mutex_unlock:
        mutex_unlock(&wl->mutex);

        return err;
}

<--  snip  -->


If (b43_status(dev) == B43_STAT_STARTED) this function returns the value 
of an uninitialized variable.

drivers/net/wireless/b43legacy/main.c:b43legacy_start() has the same 
issue.

Spotted by the Coverity checker.


cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* [-mm Patch] drivers/net/wireless/b43/main.c: fix an uninitialized variable
  2007-10-14 17:51 b43{,legacy}_start can return uninitialized value Adrian Bunk
@ 2007-10-15 11:34 ` WANG Cong
  2007-10-15 12:56   ` Adrian Bunk
  2007-10-15 11:59 ` [-mm Patch] drivers/net/wireless/b43legacy/main.c: initialize the correct return value WANG Cong
  1 sibling, 1 reply; 6+ messages in thread
From: WANG Cong @ 2007-10-15 11:34 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: mb, st3, Larry.Finger, linux-wireless, linux-kernel,
	Andrew Morton


Fix an uninitialized variable in drivers/net/wireless/b43/main.c::b43_start().

From: Adrian Bunk <bunk@kernel.org>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>

---
 drivers/net/wireless/b43/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.23-mm1/drivers/net/wireless/b43/main.c
===================================================================
--- linux-2.6.23-mm1.orig/drivers/net/wireless/b43/main.c
+++ linux-2.6.23-mm1/drivers/net/wireless/b43/main.c
@@ -3495,7 +3495,7 @@ static int b43_start(struct ieee80211_hw
 	struct b43_wl *wl = hw_to_b43_wl(hw);
 	struct b43_wldev *dev = wl->current_dev;
 	int did_init = 0;
-	int err;
+	int err = 0;
 
 	mutex_lock(&wl->mutex);
 

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

* [-mm Patch] drivers/net/wireless/b43legacy/main.c: initialize the correct return value
  2007-10-14 17:51 b43{,legacy}_start can return uninitialized value Adrian Bunk
  2007-10-15 11:34 ` [-mm Patch] drivers/net/wireless/b43/main.c: fix an uninitialized variable WANG Cong
@ 2007-10-15 11:59 ` WANG Cong
  2007-10-15 15:03   ` Larry Finger
  1 sibling, 1 reply; 6+ messages in thread
From: WANG Cong @ 2007-10-15 11:59 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: mb, st3, Larry.Finger, linux-wireless, linux-kernel,
	Andrew Morton


Initialize "err" in drivers/net/wireless/b43legacy/main.c::b43legacy_start()
in case of returning an uninitialized value.

From: Adrian Bunk <bunk@kernel.org>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>

---
 drivers/net/wireless/b43/main.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.23-mm1/drivers/net/wireless/b43legacy/main.c
===================================================================
--- linux-2.6.23-mm1.orig/drivers/net/wireless/b43legacy/main.c
+++ linux-2.6.23-mm1/drivers/net/wireless/b43legacy/main.c
@@ -3306,7 +3306,7 @@ static int b43legacy_start(struct ieee80
 	struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
 	struct b43legacy_wldev *dev = wl->current_dev;
 	int did_init = 0;
-	int err;
+	int err = 0;
 
 	mutex_lock(&wl->mutex);
 

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

* Re: [-mm Patch] drivers/net/wireless/b43/main.c: fix an uninitialized variable
  2007-10-15 11:34 ` [-mm Patch] drivers/net/wireless/b43/main.c: fix an uninitialized variable WANG Cong
@ 2007-10-15 12:56   ` Adrian Bunk
  2007-10-15 13:33     ` WANG Cong
  0 siblings, 1 reply; 6+ messages in thread
From: Adrian Bunk @ 2007-10-15 12:56 UTC (permalink / raw)
  To: WANG Cong
  Cc: mb, st3, Larry.Finger, linux-wireless, linux-kernel,
	Andrew Morton

On Mon, Oct 15, 2007 at 07:34:45PM +0800, WANG Cong wrote:
> 
> Fix an uninitialized variable in drivers/net/wireless/b43/main.c::b43_start().
> 
> From: Adrian Bunk <bunk@kernel.org>

A technical remark regarding these two patches:

These are your patches, not mine.

You can note formally or informally that I reported/forwarded these 
issues, but I'm neither in a legal sense the author of these patches nor
am I in a technical sense responsible for their correctness [1], and a 
From: tag is therefore not appropriate.

> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
> 
> ---
>  drivers/net/wireless/b43/main.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-2.6.23-mm1/drivers/net/wireless/b43/main.c
> ===================================================================
> --- linux-2.6.23-mm1.orig/drivers/net/wireless/b43/main.c
> +++ linux-2.6.23-mm1/drivers/net/wireless/b43/main.c
> @@ -3495,7 +3495,7 @@ static int b43_start(struct ieee80211_hw
>  	struct b43_wl *wl = hw_to_b43_wl(hw);
>  	struct b43_wldev *dev = wl->current_dev;
>  	int did_init = 0;
> -	int err;
> +	int err = 0;
>  
>  	mutex_lock(&wl->mutex);

cu
Adrian

[1] they might or might not be correct (I don't know)

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [-mm Patch] drivers/net/wireless/b43/main.c: fix an uninitialized variable
  2007-10-15 12:56   ` Adrian Bunk
@ 2007-10-15 13:33     ` WANG Cong
  0 siblings, 0 replies; 6+ messages in thread
From: WANG Cong @ 2007-10-15 13:33 UTC (permalink / raw)
  To: Adrian Bunk
  Cc: WANG Cong, mb, st3, Larry.Finger, linux-wireless, linux-kernel,
	Andrew Morton, Jonathan Corbet

On Mon, Oct 15, 2007 at 02:56:44PM +0200, Adrian Bunk wrote:
>On Mon, Oct 15, 2007 at 07:34:45PM +0800, WANG Cong wrote:
>> 
>> Fix an uninitialized variable in drivers/net/wireless/b43/main.c::b43_start().
>> 
>> From: Adrian Bunk <bunk@kernel.org>

Reported-by: Adrian Bunk <bunk@kernel.org>

>
>A technical remark regarding these two patches:
>
>These are your patches, not mine.
>
>You can note formally or informally that I reported/forwarded these 
>issues, but I'm neither in a legal sense the author of these patches nor
>am I in a technical sense responsible for their correctness [1], and a 
>From: tag is therefore not appropriate.
>

OK. I look through Jonathan's patch[1], but didn't find a proper tag
as you suggested. I think the "Reported-by:" tag may be appropriate,
as the above.

So, we need a "Reported-by:" tag, Jonathan. Could you please consider
to add it into your patch? I didn't see it in -mm1 tree or I can give
you a patch.

CC: Jonathan Corbet <corbet@lwn.net>

Thanks!

[1] http://lkml.org/lkml/2007/10/11/255

-- 
May the Source Be With You.

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

* Re: [-mm Patch] drivers/net/wireless/b43legacy/main.c: initialize the correct return value
  2007-10-15 11:59 ` [-mm Patch] drivers/net/wireless/b43legacy/main.c: initialize the correct return value WANG Cong
@ 2007-10-15 15:03   ` Larry Finger
  0 siblings, 0 replies; 6+ messages in thread
From: Larry Finger @ 2007-10-15 15:03 UTC (permalink / raw)
  To: WANG Cong
  Cc: Adrian Bunk, mb, John Linville, linux-wireless, linux-kernel,
	Andrew Morton

WANG Cong wrote:
> Initialize "err" in drivers/net/wireless/b43legacy/main.c::b43legacy_start()
> in case of returning an uninitialized value.
> 
> From: Adrian Bunk <bunk@kernel.org>
> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
> 
> ---
>  drivers/net/wireless/b43/main.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-2.6.23-mm1/drivers/net/wireless/b43legacy/main.c
> ===================================================================
> --- linux-2.6.23-mm1.orig/drivers/net/wireless/b43legacy/main.c
> +++ linux-2.6.23-mm1/drivers/net/wireless/b43legacy/main.c
> @@ -3306,7 +3306,7 @@ static int b43legacy_start(struct ieee80
>  	struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw);
>  	struct b43legacy_wldev *dev = wl->current_dev;
>  	int did_init = 0;
> -	int err;
> +	int err = 0;
>  
>  	mutex_lock(&wl->mutex);

I sent the equivalent patch to John Linville yesterday.

Larry


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

end of thread, other threads:[~2007-10-15 15:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-14 17:51 b43{,legacy}_start can return uninitialized value Adrian Bunk
2007-10-15 11:34 ` [-mm Patch] drivers/net/wireless/b43/main.c: fix an uninitialized variable WANG Cong
2007-10-15 12:56   ` Adrian Bunk
2007-10-15 13:33     ` WANG Cong
2007-10-15 11:59 ` [-mm Patch] drivers/net/wireless/b43legacy/main.c: initialize the correct return value WANG Cong
2007-10-15 15:03   ` Larry Finger

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