From fd5f3b636788f79843d42188ed843c0416643326 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 12 Nov 2014 11:44:44 +0200 Subject: cpu: assert host pointer offset within block Make accesses safer in case we missed some check somewhere. Signed-off-by: Michael S. Tsirkin Reviewed-by: Paolo Bonzini Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Amos Kong Signed-off-by: Amit Shah --- include/exec/cpu-all.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 9d8d408ea6..7c3a5e7dd0 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; } -- cgit v1.2.3