kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: mvumi: fix 32 bit shift of a 32 bit unsigned int
@ 2019-02-16 14:44 Colin King
  2019-02-16 16:27 ` Walter Harms
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Colin King @ 2019-02-16 14:44 UTC (permalink / raw)
  To: Jianyun Li, James E . J . Bottomley, Martin K . Petersen,
	linux-scsi
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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 <colin.king@canonical.com>
---
 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);
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-08-14 15:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-16 14:44 [PATCH] scsi: mvumi: fix 32 bit shift of a 32 bit unsigned int Colin King
2019-02-16 16:27 ` Walter Harms
2019-02-18  9:37   ` Dan Carpenter
2019-02-18 15:32     ` James Bottomley
2019-02-18 15:47       ` Dan Carpenter
2019-02-18 12:42 ` Walter Harms
2019-02-18 14:24 ` Dan Carpenter
2019-02-18 16:52 ` Walter Harms
2019-08-13 18:01 ` [PATCH] scsi: mvumi: fix 32 bit shift of a u32 value Colin King
2019-08-14  7:17   ` walter harms
2019-08-14  8:07   ` Dan Carpenter
2019-08-14 15:07   ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).