Patchwork Add missing check for host_from_stream_offset return value for RAM_SAVE_FLAG_PAGE

login
register
mail settings
Submitter Orit Wasserman
Date June 19, 2012, 8:51 a.m.
Message ID <1340095897-3033-1-git-send-email-owasserm@redhat.com>
Download mbox | patch
Permalink /patch/165697/
State New
Headers show

Comments

Orit Wasserman - June 19, 2012, 8:51 a.m.
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
---
 arch_init.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Juan Quintela - June 19, 2012, 1:23 p.m.
Orit Wasserman <owasserm@redhat.com> wrote:
> Signed-off-by: Orit Wasserman <owasserm@redhat.com>

Reviewed-by: Juan Quintela <quintela@redhat.com>

Patch

diff --git a/arch_init.c b/arch_init.c
index a9e8b74..81c2e54 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -483,6 +483,9 @@  int ram_load(QEMUFile *f, void *opaque, int version_id)
             void *host;
 
             host = host_from_stream_offset(f, addr, flags);
+            if (!host) {
+                return -EINVAL;
+            }
 
             qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
         }