From: Dan Carpenter <dan.carpenter@oracle.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: QLogic-Storage-Upstream@qlogic.com, jejb@linux.vnet.ibm.com,
martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] bnx2fc: shift wrapping bug in bnx2fc_process_unsol_compl()
Date: Mon, 28 Nov 2016 13:24:45 +0000 [thread overview]
Message-ID: <20161128132137.GR6266@mwanda> (raw)
In-Reply-To: <20161126183629.9969-1-christophe.jaillet@wanadoo.fr>
On Sat, Nov 26, 2016 at 07:36:29PM +0100, Christophe JAILLET wrote:
> BNX2FC_NUM_ERR_BITS is 63. err_warn_bit_map is a u64. So, to make sure that
> no shift wrapping will occur, we need need additionnal casting.
>
> The same test is already done a few lines above and '(u64)1' is already
> used there. So just do the same here.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> I guess that this could also be written with a '1ULL << i' which would be
> cleaner and less verbose IMHO, but apparently this driver does not use
> such things yet. So keep the current style with casting.
Ugh... No. This is not code to emulate. Use 1ULL << i. Even if we
did the cast, you would only need one:
if (err_warn_bit_map & ((u64)1 << i)) {
regards,
dan carpenter
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: QLogic-Storage-Upstream@qlogic.com, jejb@linux.vnet.ibm.com,
martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] bnx2fc: shift wrapping bug in bnx2fc_process_unsol_compl()
Date: Mon, 28 Nov 2016 16:24:45 +0300 [thread overview]
Message-ID: <20161128132137.GR6266@mwanda> (raw)
In-Reply-To: <20161126183629.9969-1-christophe.jaillet@wanadoo.fr>
On Sat, Nov 26, 2016 at 07:36:29PM +0100, Christophe JAILLET wrote:
> BNX2FC_NUM_ERR_BITS is 63. err_warn_bit_map is a u64. So, to make sure that
> no shift wrapping will occur, we need need additionnal casting.
>
> The same test is already done a few lines above and '(u64)1' is already
> used there. So just do the same here.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> I guess that this could also be written with a '1ULL << i' which would be
> cleaner and less verbose IMHO, but apparently this driver does not use
> such things yet. So keep the current style with casting.
Ugh... No. This is not code to emulate. Use 1ULL << i. Even if we
did the cast, you would only need one:
if (err_warn_bit_map & ((u64)1 << i)) {
regards,
dan carpenter
next prev parent reply other threads:[~2016-11-28 13:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-26 18:36 [PATCH] bnx2fc: shift wrapping bug in bnx2fc_process_unsol_compl() Christophe JAILLET
2016-11-26 18:36 ` Christophe JAILLET
2016-11-28 13:24 ` Dan Carpenter [this message]
2016-11-28 13:24 ` Dan Carpenter
2016-11-28 17:05 ` Laurence Oberman
2016-11-28 17:05 ` Laurence Oberman
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=20161128132137.GR6266@mwanda \
--to=dan.carpenter@oracle.com \
--cc=QLogic-Storage-Upstream@qlogic.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=jejb@linux.vnet.ibm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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 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.