summaryrefslogtreecommitdiffstats
path: root/memory.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2015-11-06 16:02:45 +0800
committerMichael S. Tsirkin <mst@redhat.com>2015-11-12 15:49:32 +0200
commitb8aecea23aaccf39da54c77ef248f5fa50dcfbc1 (patch)
tree029c44aaaa017d0b13a44da65f5b9caeb1f22a16 /memory.c
parenta6df8adf3edbb3062f087e425564df35077e8410 (diff)
downloadhqemu-b8aecea23aaccf39da54c77ef248f5fa50dcfbc1.zip
hqemu-b8aecea23aaccf39da54c77ef248f5fa50dcfbc1.tar.gz
memory: don't try to adjust endianness for zero length eventfd
There's no need to adjust endianness for zero length eventfd since the data wrote was actually ignored by kernel. So skip the adjust in this case to fix a possible crash when trying to use wildcard mmio eventfd in ppc. Cc: Greg Kurz <gkurz@linux.vnet.ibm.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Acked-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/memory.c b/memory.c
index c435c88..e193658 100644
--- a/memory.c
+++ b/memory.c
@@ -1688,7 +1688,9 @@ void memory_region_add_eventfd(MemoryRegion *mr,
};
unsigned i;
- adjust_endianness(mr, &mrfd.data, size);
+ if (size) {
+ adjust_endianness(mr, &mrfd.data, size);
+ }
memory_region_transaction_begin();
for (i = 0; i < mr->ioeventfd_nb; ++i) {
if (memory_region_ioeventfd_before(mrfd, mr->ioeventfds[i])) {
@@ -1721,7 +1723,9 @@ void memory_region_del_eventfd(MemoryRegion *mr,
};
unsigned i;
- adjust_endianness(mr, &mrfd.data, size);
+ if (size) {
+ adjust_endianness(mr, &mrfd.data, size);
+ }
memory_region_transaction_begin();
for (i = 0; i < mr->ioeventfd_nb; ++i) {
if (memory_region_ioeventfd_equal(mrfd, mr->ioeventfds[i])) {
OpenPOWER on IntegriCloud