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>
This commit is contained in:
parent
1240be2435
commit
fd5f3b6367
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user