diff options
author | Prasad J Pandit <pjp@fedoraproject.org> | 2017-07-12 18:08:40 +0530 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-07-14 11:04:34 +0200 |
commit | 04bf2526ce87f21b32c9acba1c5518708c243ad0 (patch) | |
tree | 327929491c477bf1f2ba2da0c25efe64cc51637e /exec.c | |
parent | 1a29cc8f5ebd657e159dbe4be340102595846d42 (diff) | |
download | qemu-04bf2526ce87f21b32c9acba1c5518708c243ad0.zip qemu-04bf2526ce87f21b32c9acba1c5518708c243ad0.tar.gz qemu-04bf2526ce87f21b32c9acba1c5518708c243ad0.tar.bz2 |
exec: use qemu_ram_ptr_length to access guest ram
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 <broscutamaker@gmail.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Message-Id: <20170712123840.29328-1-ppandit@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r-- | exec.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); } |