Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3000585ybi; Mon, 17 Jun 2019 14:24:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQ9E9DRTHAvnd8rMuSGKtf6pKb8FHXrXdp3HJwcSEBwBrwYuXc3EVXmO2aj5PvX4Bk4yzY X-Received: by 2002:a17:90a:b30a:: with SMTP id d10mr1203504pjr.8.1560806642096; Mon, 17 Jun 2019 14:24:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560806642; cv=none; d=google.com; s=arc-20160816; b=N8LjifniqOcqZPfQeJCjlzmZbgQKyofMhBzWfEzU6QSUabXnwjtboc8FPZKsN8V4Ta Rf/sYf+EziJxTl2NOlotsmtNKKHLziLbwauS7fLMeoi7tjMXHhMM8rpzJ1vfmXFiUPf3 rzeO6sAtWY2bR5qTAi5yQsKhJKg8Xl5ybE0nU/vWzq4XEI5fV5WR0SsVRgogDw8/7ERp VCLK+XnGUIEIl7kZq+oVNBT861EZ0jfxXYU9miZzAbFoBY5wZJR5nAU9Kw7qPCfw4MXb i0SvIhBOJpCug08aZZCPjWLLTApYLRj2j6j9s4XzeSyqDTGy3kaFvic4MM79qlkQog+r Hh4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JlV6HRWTu0xDaD+PX0OLuNiKerNuWJSVqfqjK9hrSRg=; b=NlgREi4A5mtMqSWpDNtxL7WRfjZ8ahorixAe5ruNkOIL8ice6RboWc9nb6uoWip1ue tyhIjz1H+o7l4bTUL3ipoHfC/iSvUpdjkLSS8q1U1SIinBgo1Pi5k4B5hUsDaIBGDvoc ATYU5D4Hzo9SxIef4Oo/tt4Fy5NI68SvvMNlD3jd4cy6WmSl/j53MZOLsvLq5JdpxX3N 5ShcSxxhjI2+htiTSVfdlFIuArce7+RwRkTpUzEe/dXx8k9qiflJ/DZbtDQeEECw4czZ Qu80KNvxMNoCkTbSF1B+odtq/9rogx7lgK9C1EJsq+JHdYu3eBi3bBrKGRC76oJR/C7a gzPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DCY9suqv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t135si12394457pfc.251.2019.06.17.14.23.47; Mon, 17 Jun 2019 14:24:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DCY9suqv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729425AbfFQVVv (ORCPT + 99 others); Mon, 17 Jun 2019 17:21:51 -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