From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Ron Mercer <ron.mercer@qlogic.com>,
linux-driver@qlogic.com, netdev <netdev@vger.kernel.org>
Subject: Re: qla3xxx: Odd likely incorrect use of test_bit in qla3xxx.c
Date: Thu, 14 May 2015 01:22:57 -0700 [thread overview]
Message-ID: <1431591777.2912.28.camel@perches.com> (raw)
In-Reply-To: <20150514080116.GF8431@mwanda>
On Thu, 2015-05-14 at 11:01 +0300, Dan Carpenter wrote:
> On Wed, May 13, 2015 at 10:34:51AM -0700, Joe Perches wrote:
> > In case the patches you found weren't of this type,
> > there are other possibly suspicious uses with & like:
> > drivers/usb/host/ehci-tegra.c: set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports);
> That's puzzling, yes, but my instinct without looking at the context is
> that it's probably valid.
It may be valid, but at a minimum it's bad code.
Assuming wIndex is guaranteed non-zero, it likely
should be something like:
(wIndex % BITS_PER_LONG) - 1
or suspended_ports should be more than a single ulong
Anyway, thanks.
prev parent reply other threads:[~2015-05-14 8:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 18:42 qla3xxx: Odd likely incorrect use of test_bit in qla3xxx.c Joe Perches
2015-05-13 13:19 ` Dan Carpenter
2015-05-13 16:08 ` Joe Perches
2015-05-13 17:34 ` Joe Perches
2015-05-14 8:01 ` Dan Carpenter
2015-05-14 8:22 ` Joe Perches [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=1431591777.2912.28.camel@perches.com \
--to=joe@perches.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-driver@qlogic.com \
--cc=netdev@vger.kernel.org \
--cc=ron.mercer@qlogic.com \
/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).