summaryrefslogtreecommitdiffstats
path: root/include/exec
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2014-11-12 11:44:44 +0200
committerAmit Shah <amit.shah@redhat.com>2014-12-16 17:47:35 +0530
commitfd5f3b636788f79843d42188ed843c0416643326 (patch)
treeb9a249e3497b3140ec53143703341dcffa031931 /include/exec
parent1240be24357ee292f8d05aa2abfdba75dd0ca25d (diff)
downloadhqemu-fd5f3b636788f79843d42188ed843c0416643326.zip
hqemu-fd5f3b636788f79843d42188ed843c0416643326.tar.gz
cpu: assert host pointer offset within block
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>
Diffstat (limited to 'include/exec')
-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 9d8d408..7c3a5e7 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -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;
}
OpenPOWER on IntegriCloud