mirror of https://github.com/xemu-project/xemu.git
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>
This commit is contained in:
parent
ab9b872ab3
commit
a184e74f24
|
@ -522,8 +522,8 @@ void nand_setio(DeviceState *dev, uint32_t value)
|
||||||
|
|
||||||
if (s->ale) {
|
if (s->ale) {
|
||||||
unsigned int shift = s->addrlen * 8;
|
unsigned int shift = s->addrlen * 8;
|
||||||
unsigned int mask = ~(0xff << shift);
|
uint64_t mask = ~(0xffull << shift);
|
||||||
unsigned int v = value << shift;
|
uint64_t v = (uint64_t)value << shift;
|
||||||
|
|
||||||
s->addr = (s->addr & mask) | v;
|
s->addr = (s->addr & mask) | v;
|
||||||
s->addrlen ++;
|
s->addrlen ++;
|
||||||
|
|
Loading…
Reference in New Issue