qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Li Qiang <liq3ea@gmail.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@gmail.com>,
	"P J P" <ppandit@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] memory: check write/read_with_attrs in memory dispatch
Date: Tue, 13 Nov 2018 09:49:28 +0000	[thread overview]
Message-ID: <CAFEAcA-GU85D_7kopc2s7GmTExsqSda0j73v2ecafr_FGKYBLw@mail.gmail.com> (raw)
In-Reply-To: <1542073341-2843-1-git-send-email-liq3ea@gmail.com>

On 13 November 2018 at 01:42, Li Qiang <liq3ea@gmail.com> wrote:
> This can avoid the NULL-deref if the rm doesn't has a
> read/write nor write/read_with_attrs callback.
>
> Signed-off-by: Li Qiang <liq3ea@gmail.com>
> ---
>  memory.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Alternative approach -- assert that every MemoryRegionOps has
pointers to callbacks in it, when it is registered in memory_region_init_io()
and memory_region_init_rom_device_nomigrate().

I don't have a strong opinion on which is better, but I guess
I slightly favour requiring devices to be specific about what
their read/write behaviour is.

Do we have many devices that legitimately only want to implement
one of read and write, not both ?

thanks
-- PMM

  reply	other threads:[~2018-11-13  9:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13  1:42 [Qemu-devel] [PATCH] memory: check write/read_with_attrs in memory dispatch Li Qiang
2018-11-13  9:49 ` Peter Maydell [this message]
2018-11-13 10:10   ` Li Qiang
2018-11-21  3:23 ` Li Qiang

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=CAFEAcA-GU85D_7kopc2s7GmTExsqSda0j73v2ecafr_FGKYBLw@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=liq3ea@gmail.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).