linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Büsch" <m@bues.ch>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org
Subject: Re: (bug report) b43: impossible conditions in debugfs
Date: Thu, 26 Nov 2015 14:34:16 +0100	[thread overview]
Message-ID: <20151126143416.6104ff24@wiggum> (raw)
In-Reply-To: <20151126130033.GG7289@mwanda>

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

On Thu, 26 Nov 2015 16:00:34 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> On Thu, Nov 26, 2015 at 01:32:41PM +0100, Michael Büsch wrote:
> > > See also:
> > > drivers/net/wireless/broadcom/b43/debugfs.c:346 mmio32write__write_file() warn: impossible condition '(mask > 4294967295) => (0-u32max > u32max)'
> > > drivers/net/wireless/broadcom/b43/debugfs.c:346 mmio32write__write_file() warn: impossible condition '(set > 4294967295) => (0-u32max > u32max)'  
> > 
> > 
> > 
> > Sure. These are intentional.
> > The compiler will optimize this out.  
> 
> Hm...  We try to ignore when people do intentional comparisons with zero
> like this:
> 
> 	if (unsigned_var < 0 || unsigned_var >= 10)
> 		return -EINVAL;
> 
> Because they are obviously harmless and they don't hurt readability.
> Also Linus doesn't like removing these.


It just checks whether the value will fit into a 32 bit unsigned int
variable. It doesn't make assumptions on what sizeof(unsigned int) is,
although it would be safe to assume 4 here and omit the check.

-- 
Michael

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

      reply	other threads:[~2015-11-26 13:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 11:59 (bug report) b43: impossible conditions in debugfs Dan Carpenter
2015-11-26 12:32 ` Michael Büsch
2015-11-26 13:00   ` Dan Carpenter
2015-11-26 13:34     ` 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=20151126143416.6104ff24@wiggum \
    --to=m@bues.ch \
    --cc=b43-dev@lists.infradead.org \
    --cc=dan.carpenter@oracle.com \
    --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).