public inbox for b43-dev@lists.infradead.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: mb@bu3sch.de
Cc: linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org
Subject: (bug report) b43: impossible conditions in debugfs
Date: Thu, 26 Nov 2015 14:59:24 +0300	[thread overview]
Message-ID: <20151126115924.GI10556@mwanda> (raw)

Hello Michael Buesch,

The patch 6bbc321a96d4: "b43: Add debugfs files for random SHM
access" from Jun 19, 2008, leads to the following static checker
warning:

	drivers/net/wireless/broadcom/b43/debugfs.c:217 shm32write__write_file()
	warn: impossible condition '(mask > 4294967295) => (0-u32max > u32max)'

drivers/net/wireless/broadcom/b43/debugfs.c
   198  static int shm32write__write_file(struct b43_wldev *dev,
   199                                    const char *buf, size_t count)
   200  {
   201          unsigned int routing, addr, mask, set;
   202          u32 val;
   203          int res;
   204  
   205          res = sscanf(buf, "0x%X 0x%X 0x%X 0x%X",
   206                       &routing, &addr, &mask, &set);
   207          if (res != 4)
   208                  return -EINVAL;
   209          if (routing > B43_MAX_SHM_ROUTING)
   210                  return -EADDRNOTAVAIL;
   211          if (addr > B43_MAX_SHM_ADDR)
   212                  return -EADDRNOTAVAIL;
   213          if (routing == B43_SHM_SHARED) {
   214                  if ((addr % 2) != 0)
   215                          return -EADDRNOTAVAIL;
   216          }
   217          if ((mask > 0xFFFFFFFF) || (set > 0xFFFFFFFF))

Both of these conditions are impossible.

   218                  return -E2BIG;
   219  
   220          if (mask == 0)
   221                  val = 0;
   222          else
   223                  val = b43_shm_read32(dev, routing, addr);
   224          val &= mask;
   225          val |= set;
   226          b43_shm_write32(dev, routing, addr, val);
   227  
   228          return 0;
   229  }

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


regards,
dan carpenter

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

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26 11:59 Dan Carpenter [this message]
2015-11-26 12:32 ` (bug report) b43: impossible conditions in debugfs Michael Büsch
2015-11-26 13:00   ` Dan Carpenter
2015-11-26 13:34     ` Michael Büsch

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=20151126115924.GI10556@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=b43-dev@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mb@bu3sch.de \
    /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