[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v1] exec: handle NULL pointer in flatview_read_conti

From: Olaf Hering
Subject: [Qemu-devel] [PATCH v1] exec: handle NULL pointer in flatview_read_continue
Date: Thu, 9 Aug 2018 16:14:03 +0200

The codepaths behind qemu_ram_ptr_length can return NULL.
Avoid crashing the device-model in such case, just move on.

Signed-off-by: Olaf Hering <address@hidden>
This happens if calling xendevicemodel_create_ioreq_server() is disabled,
and eventually if that function returns an error.
 exec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/exec.c b/exec.c
index 4f5df07b6a..0d30e48571 100644
--- a/exec.c
+++ b/exec.c
@@ -3318,7 +3318,8 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr 
         } else {
             /* RAM case */
             ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);
-            memcpy(buf, ptr, l);
+           if (ptr)
+                memcpy(buf, ptr, l);
         if (release_lock) {

reply via email to

[Prev in Thread] Current Thread [Next in Thread]