Re: [PATCH] mmc: cavium: Fix a shift wrapping bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13 April 2017 at 21:47, Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> "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@xxxxxxxxxx>

Thanks, applied for next!

Kind regards
Uffe

>
> 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;
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux