File 0150-cpu-verify-that-block-host-is-set.patch of Package qemu.8405

From 9cd8526eacecb16bca4cd5bf7d2119d6bcc06f50 Mon Sep 17 00:00:00 2001
From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Wed, 12 Nov 2014 11:44:47 +0200
Subject: [PATCH] cpu: verify that block->host is set

If it isn't, access at an offset will cause memory corruption.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amos Kong <akong@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
(cherry picked from commit b78accf6147a87a3d9c1cd4287d7a1ff805f358e)

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 include/exec/cpu-all.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 8df6e20397..d8041130ae 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -436,6 +436,7 @@ typedef struct RAMBlock {
 static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
 {
     assert(offset < block->length);
+    assert(block->host);
     return (char *)block->host + offset;
 }
 
openSUSE Build Service is sponsored by