diff options
| author | Michael S. Tsirkin | 2014-11-12 10:44:47 +0100 |
|---|---|---|
| committer | Amit Shah | 2014-12-16 13:17:35 +0100 |
| commit | b78accf6147a87a3d9c1cd4287d7a1ff805f358e (patch) | |
| tree | e727590c0469230e7c3ae61774b6435d2f57f020 | |
| parent | cpu: assert host pointer offset within block (diff) | |
| download | qemu-b78accf6147a87a3d9c1cd4287d7a1ff805f358e.tar.gz qemu-b78accf6147a87a3d9c1cd4287d7a1ff805f358e.tar.xz qemu-b78accf6147a87a3d9c1cd4287d7a1ff805f358e.zip | |
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.h | 1 |
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; } |
