linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Büsch" <m@bues.ch>
To: Larry Finger <Larry.Finger@lwfinger.net>
Cc: wireless <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH] b43: Fix smatch warning
Date: Sat, 27 Aug 2011 23:31:11 +0200	[thread overview]
Message-ID: <20110827233111.6480df17@milhouse> (raw)
In-Reply-To: <4E59426F.1050401@lwfinger.net>

On Sat, 27 Aug 2011 14:15:59 -0500
Larry Finger <Larry.Finger@lwfinger.net> wrote:

> On 08/27/2011 01:54 PM, Michael Büsch wrote:
> > On Sat, 27 Aug 2011 13:26:00 -0500
> > Larry Finger<Larry.Finger@lwfinger.net>  wrote:
> >
> >>    CHECK   drivers/net/wireless/b43/main.c
> >> drivers/net/wireless/b43/main.c +4115 b43_wireless_core_stop(7) warn: variable dereferenced before check 'dev'
> >
> >> This is next material.
> >
> > -next, just because the bug is not in the current kernel?
> > Or because you think this is harmless?
> >
> > I'm not sure whether this is harmless. It effectively is that kind
> > of bug that triggers dangerous compiler optimizations.
> > I think the compiler has some freedom to assume dev can not be NULL when
> > the function is entered and thus optimize out the !dev check.
> 
> No, the check has to be left in due to the changing of dev in the routine 
> followed by a 'goto redo'.

I think the compiler is still free to emit the !dev check twice.
Or the other way around: Emit it correctly for the "goto" case and
don't emit it for the function-enter case (and directly check dev->status).

> In fact, a bug in the original code is unlikely, but my patch did add one. I 
> think the code should be
> 
> 	if (!dev)
> 		return NULL;
> 	wl = dev->wl;
> redo:

yes


-- 
Greetings, Michael.

      reply	other threads:[~2011-08-27 21:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-27 18:26 [PATCH] b43: Fix smatch warning Larry Finger
     [not found] ` <20110827205404.62de7b31@milhouse>
2011-08-27 19:15   ` Larry Finger
2011-08-27 21:31     ` Michael Büsch [this message]

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=20110827233111.6480df17@milhouse \
    --to=m@bues.ch \
    --cc=Larry.Finger@lwfinger.net \
    --cc=linux-wireless@vger.kernel.org \
    /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 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).