public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: cavium: Fix a shift wrapping bug
@ 2017-04-13 19:47 Dan Carpenter
  2017-04-18 19:15 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-04-13 19:47 UTC (permalink / raw)
  To: Jan Glauber
  Cc: David Daney, Steven J. Hill, Ulf Hansson, linux-mmc,
	kernel-janitors

"dat" is a u64 and "shift" starts as 54 so this is a shift wrapping bug.

Fixes: 8047c753f3d3 ("mmc: cavium: Add core MMC driver for Cavium SOCs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/mmc/host/cavium.c b/drivers/mmc/host/cavium.c
index d842b6986189..54ff1363b564 100644
--- a/drivers/mmc/host/cavium.c
+++ b/drivers/mmc/host/cavium.c
@@ -733,7 +733,7 @@ static void do_write_request(struct cvm_mmc_host *host, struct mmc_request *mrq)
 		}
 
 		while (smi->consumed < smi->length && shift >= 0) {
-			dat |= ((u8 *)smi->addr)[smi->consumed] << shift;
+			dat |= (u64)((u8 *)smi->addr)[smi->consumed] << shift;
 			bytes_xfered++;
 			smi->consumed++;
 			shift -= 8;

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

end of thread, other threads:[~2017-04-18 19:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-13 19:47 [PATCH] mmc: cavium: Fix a shift wrapping bug Dan Carpenter
2017-04-18 19:15 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox