Commit 098178f2 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

exec: fix writing to MMIO area with non-power-of-two length

The problem is introduced by commit 23326164

 (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.

Reported-by: default avatarOleksii Shevchuk <>
Tested-by: default avatarOleksii Shevchuk <>
Signed-off-by: default avatarPaolo Bonzini <>
parent aaa6a401
......@@ -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;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment