Skip to content

Commit

Permalink
mmc: cavium: Fix a shift wrapping bug
Browse files Browse the repository at this point in the history
"dat" is a u64 and "shift" starts as 54 so this is a shift wrapping bug.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
  • Loading branch information
Dan Carpenter authored and Ulf Hansson committed Apr 24, 2017
1 parent fe79018 commit 3fcc783
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mmc/host/cavium.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3fcc783

Please sign in to comment.