exec: use qemu_ram_ptr_length to access guest ram
PATCH 1/1 exec: use qemu_ram_ptr_length to access guest ram
From: Prasad J Pandit <[email protected]>
When accessing guest's ram block during DMA operation, use 'qemu_ram_ptr_length' to get ram block pointer. It ensures that DMA operation of given length is possible; And avoids any OOB memory access situations.
Reported-by Alex <[email protected]>
Signed-off-by Prasad J Pandit <[email protected]>
--- exec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
exec.c +2 -2
@@ -2929,7 +2929,7 @@ static MemTxResult address_space_write_continue(AddressSpace *as, hwaddr addr, } }else {/* RAM case */ - ptr =qemu_map_ram_ptr (mr->ram_block, addr1); + ptr =qemu_ram_ptr_length (mr->ram_block, addr1, &l);memcpy (ptr, buf, l);invalidate_and_set_dirty (mr, addr1, l); }
@@ -3020,7 +3020,7 @@ MemTxResult address_space_read_continue(AddressSpace *as, hwaddr addr, } }else {/* RAM case */ - ptr =qemu_map_ram_ptr (mr->ram_block, addr1); + ptr =qemu_ram_ptr_length (mr->ram_block, addr1, &l);memcpy (buf, ptr, l); }
Signature · 1 line
2.9.4