[Qemu-devel] [PATCH] memory: Correct access mask generation in access_with_adjusted_size

Francisco Iglesias posted 1 patch 17 weeks ago
Test s390x passed
Test FreeBSD passed
Test docker-mingw@fedora passed
Test asan passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190812152841.22908-1-frasse.iglesias@gmail.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>
memory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

[Qemu-devel] [PATCH] memory: Correct access mask generation in access_with_adjusted_size

Posted by Francisco Iglesias 17 weeks ago
Also consider the requested transaction size when generating the access
mask (so that only the requested bytes are returned when those are less
than the memory region's minimum access size).

Signed-off-by: Francisco Iglesias <frasse.iglesias@gmail.com>
---
 memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/memory.c b/memory.c
index 5d8c9a9234..56a2510836 100644
--- a/memory.c
+++ b/memory.c
@@ -563,7 +563,7 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
 
     /* FIXME: support unaligned access? */
     access_size = MAX(MIN(size, access_size_max), access_size_min);
-    access_mask = MAKE_64BIT_MASK(0, access_size * 8);
+    access_mask = MAKE_64BIT_MASK(0, MIN(size, access_size) * 8);
     if (memory_region_big_endian(mr)) {
         for (i = 0; i < size; i += access_size) {
             r |= access_fn(mr, addr + i, value, access_size,
-- 
2.11.0