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 46AB0C43613 for ; Thu, 20 Jun 2019 18:06:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D03621537 for ; Thu, 20 Jun 2019 18:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561053985; bh=lmntd1Svq29Hmbo+OEIS4yxSDytl5qXQ4WNNjhFS5DE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pPifJdQXD7I9x830T+SzEgBgOvswtFpUi9+124mnCOZBobovGDAJceexl/YJcoCt8 DP4tmpPihqpIbJJFhoC4CLEeXoHmh2kYD9sWruLXuFwTpKpSht423waGZvfcgqSHpQ /I4+7jy97ISJmNuY7RdwAHrClI3dhYY/RZYrbNX4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728138AbfFTSGY (ORCPT ); Thu, 20 Jun 2019 14:06:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:60462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727186AbfFTSGT (ORCPT ); Thu, 20 Jun 2019 14:06:19 -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 878D3204FD; Thu, 20 Jun 2019 18:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561053979; bh=lmntd1Svq29Hmbo+OEIS4yxSDytl5qXQ4WNNjhFS5DE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i8LdbfIPw2HGFYc8uIvkBtcnrVf2EaEtinSuT/TSVQZVU2S4ZMATRo1XTxkzhzftT vW1Mi6OB7g2a0P7BVJ1WIKYYjaBCRIv/Zf7qiFNBVrjFWOh4lHEXcu1oSgvk7Eg+WK nVbQL8vptGHcRokUOWmog33HwbUSrSeYFGcNwmG8= 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.9 076/117] scsi: bnx2fc: fix incorrect cast to u64 on shift operation Date: Thu, 20 Jun 2019 19:56:50 +0200 Message-Id: <20190620174357.045834318@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190620174351.964339809@linuxfoundation.org> References: <20190620174351.964339809@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 5ff9f89c17c7..39b2f60149d9 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_hwi.c +++ b/drivers/scsi/bnx2fc/bnx2fc_hwi.c @@ -829,7 +829,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