aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-11-12 11:44:47 +0200
committerAmit Shah <amit.shah@redhat.com>2014-12-16 17:47:35 +0530
commitb78accf6147a87a3d9c1cd4287d7a1ff805f358e (patch)
treee727590c0469230e7c3ae61774b6435d2f57f020
parentfd5f3b636788f79843d42188ed843c0416643326 (diff)
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>
-rw-r--r--include/exec/cpu-all.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 7c3a5e7dd0..62f558103d 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -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;
}