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,URIBL_BLOCKED,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 5F984C31E5B for ; Mon, 17 Jun 2019 21:26:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 24DFE20861 for ; Mon, 17 Jun 2019 21:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806762; bh=DUJNZJz302NLD9LB0Lg9T+exl8cte3FAX6LRK54KuWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Supa+aHikIjCNg4oYQVsxaj+e2yS6k9772MEew2NkfKYz+TkDdFtxY36FcCqbnS9C 8OUjqHozYbIDaND3CwxBP9msLUqrip7m5FIPAsJeePrRGhfZG34DKf20MKWURTEDsW uGmIXTiTI7KwTeA6sLnMNjeY1UOf0X0vg9m2bzVc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728821AbfFQV0B (ORCPT ); Mon, 17 Jun 2019 17:26:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:52342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730137AbfFQVZ4 (ORCPT ); Mon, 17 Jun 2019 17:25:56 -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 504BB2182B; Mon, 17 Jun 2019 21:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806755; bh=DUJNZJz302NLD9LB0Lg9T+exl8cte3FAX6LRK54KuWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LOFRvlVvDy0aFFXUKkAIWPM6eeBeqFOiCfqsj0CdGd9WRd/ieie1o16pGenbuXSWQ DJIp2e6voZWiZeZhE7JLbkKjfXvPGUVPLw1pXX44avqPm9rYvx5ZeAZTDo229zPBcr rhFUL7RMp7z9i3212ORUc4PsEL8a6Wpt9C2WN15g= 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 4.19 46/75] scsi: bnx2fc: fix incorrect cast to u64 on shift operation Date: Mon, 17 Jun 2019 23:09:57 +0200 Message-Id: <20190617210754.537031685@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210752.799453599@linuxfoundation.org> References: <20190617210752.799453599@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 e8ae4d671d23..097305949a95 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