diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2013-07-29 14:27:39 +0200 |
---|---|---|
committer | Michael Roth <mdroth@linux.vnet.ibm.com> | 2013-09-24 22:12:44 -0500 |
commit | 9fab8e1fe15014a4bd147eeedd2491bcfbba4e59 (patch) | |
tree | e2fd1928014c7d07b92681bd8568c26fd61ba5fe /exec.c | |
parent | 2ffbe03e8bc8f330581e31537190949a9aba80c3 (diff) | |
download | qemu-9fab8e1fe15014a4bd147eeedd2491bcfbba4e59.tar.gz |
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>
(cherry picked from commit 098178f2749a63fbbb1a626dcc7d939d5cb2bde7)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1928,6 +1928,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; } |