All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Bunk <bunk@kernel.org>
To: mb@bu3sch.de, st3@riseup.net, Larry.Finger@lwfinger.net
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: b43{,legacy}_start can return uninitialized value
Date: Sun, 14 Oct 2007 19:51:42 +0200	[thread overview]
Message-ID: <20071014175142.GN4211@stusta.de> (raw)

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


             reply	other threads:[~2007-10-14 17:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-14 17:51 Adrian Bunk [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071014175142.GN4211@stusta.de \
    --to=bunk@kernel.org \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mb@bu3sch.de \
    --cc=st3@riseup.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.