[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-4.0 v4 1/4] unify len and addr type for memo
From: |
Stefano Garzarella |
Subject: |
Re: [Qemu-devel] [PATCH for-4.0 v4 1/4] unify len and addr type for memory/address APIs |
Date: |
Mon, 7 Jan 2019 11:04:46 +0100 |
Hi Li,
On Thu, Dec 6, 2018 at 3:26 AM Li Zhijian <address@hidden> wrote:
>
> Some address/memory APIs have different type between
> 'hwaddr/target_ulong addr' and 'int len'. It is very unsafe, espcially
As Philippe already suggested,
s/espcially/especially
> some APIs will be passed a non-int len by caller which might cause
> overflow quietly.
> Below is an potential overflow case:
> dma_memory_read(uint32_t len)
> -> dma_memory_rw(uint32_t len)
> -> dma_memory_rw_relaxed(uint32_t len)
> -> address_space_rw(int len) # len overflow
>
> CC: Paolo Bonzini <address@hidden>
> CC: Peter Crosthwaite <address@hidden>
> CC: Richard Henderson <address@hidden>
> CC: Peter Maydell <address@hidden>
> Signed-off-by: Li Zhijian <address@hidden>
> Reviewed-by: Peter Maydell <address@hidden>
> Reviewed-by: Richard Henderson <address@hidden>
>
> ---
> V4: minor fix at commit message and add Reviewed-by tag
> V3: use the same type between len and addr(Peter Maydell)
> rebase code basing on https://patchew.org/QEMU/address@hidden/
> ---
> exec.c | 47
> +++++++++++++++++++++++------------------------
> include/exec/cpu-all.h | 2 +-
> include/exec/cpu-common.h | 8 ++++----
> include/exec/memory.h | 22 +++++++++++-----------
> 4 files changed, 39 insertions(+), 40 deletions(-)
Reviewed-by: Stefano Garzarella <address@hidden>
- Re: [Qemu-devel] [PATCH for-4.0 v4 1/4] unify len and addr type for memory/address APIs,
Stefano Garzarella <=