From patchwork Sat Feb 16 14:44:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 10816257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BEDAE1399 for ; Sat, 16 Feb 2019 14:44:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD21220602 for ; Sat, 16 Feb 2019 14:44:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A05C4298B8; Sat, 16 Feb 2019 14:44:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50FD926246 for ; Sat, 16 Feb 2019 14:44:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728577AbfBPOoa (ORCPT ); Sat, 16 Feb 2019 09:44:30 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:54487 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728465AbfBPOo3 (ORCPT ); Sat, 16 Feb 2019 09:44:29 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1gv1Cb-00068M-7b; Sat, 16 Feb 2019 14:44:25 +0000 From: Colin King To: Jianyun Li , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: mvumi: fix 32 bit shift of a 32 bit unsigned int Date: Sat, 16 Feb 2019 14:44:24 +0000 Message-Id: <20190216144424.21438-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King Currently m_sg->baseaddr_h (a 32 bit unsigned int) is being shifted by a total of 32 bits; this always produces a 0 result. Fix this by casting it to a dma_addr_t (a 64 bit unsigned int) before performing the shift. Detected by CoverityScan, CID#147270 ("Operands don't affect result") Fixes: f0c568a478f0 ("[SCSI] mvumi: Add Marvell UMI driver") Signed-off-by: Colin Ian King --- drivers/scsi/mvumi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c index 36f64205ecfa..d3582accfd09 100644 --- a/drivers/scsi/mvumi.c +++ b/drivers/scsi/mvumi.c @@ -313,7 +313,7 @@ static void mvumi_delete_internal_cmd(struct mvumi_hba *mhba, sgd_getsz(mhba, m_sg, size); phy_addr = (dma_addr_t) m_sg->baseaddr_l | - (dma_addr_t) ((m_sg->baseaddr_h << 16) << 16); + (((dma_addr_t) m_sg->baseaddr_h << 16) << 16); dma_free_coherent(&mhba->pdev->dev, size, cmd->data_buf, phy_addr);