aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@axis.com>2015-11-10 14:25:47 +0100
committerKevin Wolf <kwolf@redhat.com>2015-11-18 15:54:15 +0100
commita184e74f24f83935c8fc7cd76c06ad0717f89fdb (patch)
treef74fc3e1db5d92b6ab97d8fc7c5dc23264b4fe5e
parentab9b872ab3147faf3c04e91d525815b9139dd996 (diff)
nand: fix address overflow
The shifts of the address mask and value shift beyond 32 bits when there are 5 address cycles. Cc: qemu-stable@nongnu.org Signed-off-by: Rabin Vincent <rabin.vincent@axis.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--hw/block/nand.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/block/nand.c b/hw/block/nand.c
index 61d2cec032..a68266f887 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 ++;