]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
cpu: assert host pointer offset within block
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 12 Nov 2014 09:44:44 +0000 (11:44 +0200)
committerAmit Shah <amit.shah@redhat.com>
Tue, 16 Dec 2014 12:17:35 +0000 (17:47 +0530)
Make accesses safer in case we missed some
check somewhere.

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 9d8d408ea68e87fc23d22b9e022c6c75ba9bbcc6..7c3a5e7dd0684b65391d98f961d742e757c06091 100644 (file)
@@ -315,6 +315,7 @@ typedef struct RAMBlock {
 
 static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
 {
+    assert(offset < block->length);
     return (char *)block->host + offset;
 }