mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-28 04:43:54 -06:00
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
1 changed files with 2 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue