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=-8.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 7CF22C31E5B for ; Mon, 17 Jun 2019 21:21:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 423D42089E for ; Mon, 17 Jun 2019 21:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806515; bh=r/w1x/QZs20IYHhHvkuwC57UoUzNrTUGxpXvROONe2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=V81fbKpJOjciQ3ZfZ88u/1Bbr4HVACRn2stweS9IR8O7UYYdaecLKgOup1wk6InLS F6vk8jQVcmVpAXqVeOA3ivo1e6X9rnzzDAxedAwa1vc6ZP7mK7gdsjIgqYst08YeSc jv1Wwjx6ToHNO1fu3RfQPFkGQuH4aaSv/Zf7sQnE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729429AbfFQVVx (ORCPT ); Mon, 17 Jun 2019 17:21:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:46312 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729415AbfFQVVq (ORCPT ); Mon, 17 Jun 2019 17:21:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E252A21734; Mon, 17 Jun 2019 21:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806505; bh=r/w1x/QZs20IYHhHvkuwC57UoUzNrTUGxpXvROONe2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DCY9suqvOkP+2467YoT6tX47pB1XaX4iERcg5VMj+iVNcmtGSx7mbTNFU/agjU9z6 DJC1mFMwZx0j79yl37XGkTW/eSVv3T5E9D7ObgBmHvG1V6geS5Ergl/qzDIGVDTrJr qIqGetShmKuWzZDqqhQjkQ8GR+WgY3vxDflHO9o4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Saurav Kashyap , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.1 074/115] scsi: bnx2fc: fix incorrect cast to u64 on shift operation Date: Mon, 17 Jun 2019 23:09:34 +0200 Message-Id: <20190617210803.812445421@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210759.929316339@linuxfoundation.org> References: <20190617210759.929316339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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 039328d9ef13..30e6d78e82f0 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c @@ -830,7 +830,7 @@ ret_err_rqe: ((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