cpu: verify that block->host is set
If it isn't, access at an offset will cause memory corruption. 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
fd5f3b6367
commit
b78accf614
@ -316,6 +316,7 @@ typedef struct RAMBlock {
|
||||
static inline void *ramblock_ptr(RAMBlock *block, ram_addr_t offset)
|
||||
{
|
||||
assert(offset < block->length);
|
||||
assert(block->host);
|
||||
return (char *)block->host + offset;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user