Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933346AbcK1RFu (ORCPT ); Mon, 28 Nov 2016 12:05:50 -0500 Received: from mx6-phx2.redhat.com ([209.132.183.39]:52314 "EHLO mx6-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932495AbcK1RFl (ORCPT ); Mon, 28 Nov 2016 12:05:41 -0500 Date: Mon, 28 Nov 2016 12:05:35 -0500 (EST) From: Laurence Oberman To: Christophe JAILLET Cc: QLogic-Storage-Upstream@qlogic.com, jejb@linux.vnet.ibm.com, martin petersen , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Message-ID: <200414664.924328.1480352735685.JavaMail.zimbra@redhat.com> In-Reply-To: <20161126183629.9969-1-christophe.jaillet@wanadoo.fr> References: <20161126183629.9969-1-christophe.jaillet@wanadoo.fr> Subject: Re: [PATCH] bnx2fc: shift wrapping bug in bnx2fc_process_unsol_compl() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.3.226.211] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - FF45 (Linux)/8.0.6_GA_5922) Thread-Topic: bnx2fc: shift wrapping bug in bnx2fc_process_unsol_compl() Thread-Index: joR+L73uNhOR8eK3GIgGZS9IE+26Ug== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2025 Lines: 51 ----- Original Message ----- > From: "Christophe JAILLET" > To: QLogic-Storage-Upstream@qlogic.com, jejb@linux.vnet.ibm.com, "martin petersen" > Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, "Christophe JAILLET" > > Sent: Saturday, November 26, 2016 1:36:29 PM > Subject: [PATCH] bnx2fc: shift wrapping bug in bnx2fc_process_unsol_compl() > > 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 > --- > 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. > --- > drivers/scsi/bnx2fc/bnx2fc_hwi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/bnx2fc/bnx2fc_hwi.c > b/drivers/scsi/bnx2fc/bnx2fc_hwi.c > index 5ff9f89c17c7..a9dccb3b49cc 100644 > --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c > +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c > @@ -829,7 +829,7 @@ static void bnx2fc_process_unsol_compl(struct > bnx2fc_rport *tgt, u16 wqe) > ((u64)err_entry->data.err_warn_bitmap_hi << 32) | > (u64)err_entry->data.err_warn_bitmap_lo; > for (i = 0; i < BNX2FC_NUM_ERR_BITS; i++) { > - if (err_warn_bit_map & (u64) (1 << i)) { > + if (err_warn_bit_map & (u64)((u64)1 << i)) { > err_warn = i; > break; > } > -- > 2.9.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Looks fine to me. Reviewed-by: Laurence Oberman