mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
exec: fix writing to MMIO area with non-power-of-two length
The problem is introduced by commit 2332616
(exec: Support 64-bit
operations in address_space_rw, 2013-07-08). Before that commit,
memory_access_size would only return 1/2/4.
Since alignment is already handled above, reduce l to the largest
power of two that is smaller than l.
Cc: qemu-stable@nongnu.org
Reported-by: Oleksii Shevchuk <alxchk@gmail.com>
Tested-by: Oleksii Shevchuk <alxchk@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
aaa6a40194
commit
098178f274
1 changed files with 3 additions and 0 deletions
3
exec.c
3
exec.c
|
@ -1913,6 +1913,9 @@ static int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)
|
|||
if (l > access_size_max) {
|
||||
l = access_size_max;
|
||||
}
|
||||
if (l & (l - 1)) {
|
||||
l = 1 << (qemu_fls(l) - 1);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue