qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: qemu-devel@nongnu.org, Michael Tsirkin <mst@redhat.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	Peter Crosthwaite <crosthwaite.peter@gmail.com>,
	philip.li@intel.com, zhijianx.li@intel.com,
	Paolo Bonzini <pbonzini@redhat.com>,
	Philippe Mathieu Daude <philmd@redhat.com>,
	Richard Henderson <rth@twiddle.net>
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	[thread overview]
Message-ID: <CAGxU2F59T+4a73vfd4mAGkC==dxqzhZKWA9sieFNPsZ2TVARCg@mail.gmail.com> (raw)
In-Reply-To: <1544063533-10139-2-git-send-email-lizhijian@cn.fujitsu.com>

Hi Li,

On Thu, Dec 6, 2018 at 3:26 AM Li Zhijian <lizhijian@cn.fujitsu.com> 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 <pbonzini@redhat.com>
> CC: Peter Crosthwaite <crosthwaite.peter@gmail.com>
> CC: Richard Henderson <rth@twiddle.net>
> CC: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> ---
> 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/20181122133507.30950-1-peter.maydell@linaro.org/
> ---
>  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 <sgarzare@redhat.com>

  reply	other threads:[~2019-01-07 10:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06  2:32 [Qemu-devel] [PATCH for-4.0 v4 0/4] allow to load initrd below 4G for recent kernel Li Zhijian
2018-12-06  2:32 ` [Qemu-devel] [PATCH for-4.0 v4 1/4] unify len and addr type for memory/address APIs Li Zhijian
2019-01-07 10:04   ` Stefano Garzarella [this message]
2019-01-08  1:06     ` Li Zhijian
2018-12-06  2:32 ` [Qemu-devel] [PATCH for-4.0 v4 2/4] refactor load_image_size Li Zhijian
2018-12-21 16:12   ` Michael S. Tsirkin
2018-12-24  2:14     ` Li Zhijian
2019-01-07 10:33       ` Stefano Garzarella
2019-01-08  1:09         ` Li Zhijian
2018-12-06  2:32 ` [Qemu-devel] [PATCH for-4.0 v4 3/4] i386: import & use bootparam.h Li Zhijian
2018-12-21 16:04   ` Michael S. Tsirkin
2019-01-04 16:41   ` Stefano Garzarella
2019-01-08  1:11     ` Li Zhijian
2018-12-06  2:32 ` [Qemu-devel] [PATCH for-4.0 v4 4/4] i386: allow to load initrd below 4G for recent linux Li Zhijian
2018-12-21 16:10   ` Michael S. Tsirkin
2018-12-27 20:31     ` Eduardo Habkost
2018-12-28  7:20       ` Li Zhijian
2019-01-07 12:11       ` Stefano Garzarella
2019-01-09  6:22         ` Li Zhijian
2019-01-07 23:35       ` Paolo Bonzini
2018-12-21  1:37 ` [Qemu-devel] [PATCH for-4.0 v4 0/4] allow to load initrd below 4G for recent kernel Li Zhijian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGxU2F59T+4a73vfd4mAGkC==dxqzhZKWA9sieFNPsZ2TVARCg@mail.gmail.com' \
    --to=sgarzare@redhat.com \
    --cc=crosthwaite.peter@gmail.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philip.li@intel.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=zhijianx.li@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).