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>
master
Michael S. Tsirkin 2014-11-12 11:44:44 +02:00 committed by Amit Shah
parent 1240be2435
commit fd5f3b6367
1 changed files with 1 additions and 0 deletions

View 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;
}