]> xenbits.xensource.com Git - qemu-xen-unstable.git/commitdiff
cpu: verify that block->host is set
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 12 Nov 2014 09:44:47 +0000 (11:44 +0200)
committerAmit Shah <amit.shah@redhat.com>
Tue, 16 Dec 2014 12:17:35 +0000 (17:47 +0530)
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>
include/exec/cpu-all.h

index 7c3a5e7dd0684b65391d98f961d742e757c06091..62f558103d86bf1e79b3127fc3779152fd6b87af 100644 (file)
@@ -316,6 +316,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;
 }