From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE701C282CE for ; Tue, 4 Jun 2019 23:26:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6ECF3206C1 for ; Tue, 4 Jun 2019 23:26:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559690785; bh=bxPVqEV9wO4+2nhR1ulIniT7wJTey7yUOQFdUmgGE/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=JkovhkhakHnf9bvZaZNGmpa5N6nFvIGRn15mtCEzP8b+piOuupMb3pm02FoNJi6i/ 5IXzt1IHmWqAgGeeHnfe1HZiOV7PzLIk7Of7rkJx1TSdKnG5hxWJxVLrGMtmwmWDEw fNTakvww0fs2jSyW8zqWpquEMj/FFvbwnUx0Me2Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727279AbfFDX0Y (ORCPT ); Tue, 4 Jun 2019 19:26:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:37632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728112AbfFDXZn (ORCPT ); Tue, 4 Jun 2019 19:25:43 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6E8C920862; Tue, 4 Jun 2019 23:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559690742; bh=bxPVqEV9wO4+2nhR1ulIniT7wJTey7yUOQFdUmgGE/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QgZZno6enpRx1ZuWwCwkD5rNZr5LzaLEAl/tOKmxt11BinaFfqDLx1HSvP4hHn7BT U3V2FQ8ETijIIZZZY8gDfC2jZUsy72MSq2KFTgqbvpy3XkchOCaniwvLqIUepKZ0Bz +bsOheYDZjwzsBPXU5UNUySfRw6GD2Y0ZFX+1p48= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Colin Ian King , Saurav Kashyap , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.4 06/10] scsi: bnx2fc: fix incorrect cast to u64 on shift operation Date: Tue, 4 Jun 2019 19:25:27 -0400 Message-Id: <20190604232532.7953-6-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190604232532.7953-1-sashal@kernel.org> References: <20190604232532.7953-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit d0c0d902339249c75da85fd9257a86cbb98dfaa5 ] Currently an int is being shifted and the result is being cast to a u64 which leads to undefined behaviour if the shift is more than 31 bits. Fix this by casting the integer value 1 to u64 before the shift operation. Addresses-Coverity: ("Bad shift operation") Fixes: 7b594769120b ("[SCSI] bnx2fc: Handle REC_TOV error code from firmware") Signed-off-by: Colin Ian King Acked-by: Saurav Kashyap Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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 28c671b609b2..0c71b69b9f88 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)1 << i)) { err_warn = i; break; } -- 2.20.1