]> xenbits.xensource.com Git - qemu-upstream-4.5-testing.git/commitdiff
exec: fix a glitch in checking dma r/w access
authorPrasad J Pandit <pjp@fedoraproject.org>
Mon, 25 Jan 2016 14:29:50 +0000 (19:59 +0530)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Fri, 5 Feb 2016 14:55:01 +0000 (14:55 +0000)
While checking r/w access in 'memory_access_is_direct' routine
a glitch in the expression leads to segmentation fault while
performing dma read operation.

Reported-by: Donghai Zdh <donghai.zdh@alibaba-inc.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
exec.c

diff --git a/exec.c b/exec.c
index cf120496f7e4467351e9ea425882432ace3866e0..e739bed778896af7e33e72bc22c36e6191510c5f 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -342,7 +342,7 @@ address_space_translate_internal(AddressSpaceDispatch *d, hwaddr addr, hwaddr *x
 static inline bool memory_access_is_direct(MemoryRegion *mr, bool is_write)
 {
     if (memory_region_is_ram(mr)) {
-        return !(is_write && mr->readonly);
+        return (is_write && !mr->readonly);
     }
     if (memory_region_is_romd(mr)) {
         return !is_write;