[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] nand: fix address overflow
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] nand: fix address overflow |
Date: |
Tue, 10 Nov 2015 16:09:37 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 10/11/2015 14:25, Rabin Vincent wrote:
> The shifts of the address mask and value shift beyond 32 bits when there
> are 5 address cycles.
>
> Signed-off-by: Rabin Vincent <address@hidden>
> ---
> hw/block/nand.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/block/nand.c b/hw/block/nand.c
> index 61d2cec..a68266f 100644
> --- a/hw/block/nand.c
> +++ b/hw/block/nand.c
> @@ -522,8 +522,8 @@ void nand_setio(DeviceState *dev, uint32_t value)
>
> if (s->ale) {
> unsigned int shift = s->addrlen * 8;
> - unsigned int mask = ~(0xff << shift);
> - unsigned int v = value << shift;
> + uint64_t mask = ~(0xffull << shift);
> + uint64_t v = (uint64_t)value << shift;
>
> s->addr = (s->addr & mask) | v;
> s->addrlen ++;
>
Cc: address@hidden
Reviewed-by: Paolo Bonzini <address@hidden>