From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jan Glauber <jglauber@cavium.com>
Cc: David Daney <david.daney@cavium.com>,
"Steven J. Hill" <Steven.Hill@cavium.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
linux-mmc@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] mmc: cavium: Fix a shift wrapping bug
Date: Thu, 13 Apr 2017 22:47:48 +0300 [thread overview]
Message-ID: <20170413194748.GE591@mwanda> (raw)
"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;
next reply other threads:[~2017-04-13 19:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-13 19:47 Dan Carpenter [this message]
2017-04-18 19:15 ` [PATCH] mmc: cavium: Fix a shift wrapping bug Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170413194748.GE591@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Steven.Hill@cavium.com \
--cc=david.daney@cavium.com \
--cc=jglauber@cavium.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox