qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] memory: Fix zero-sized memory region print
Date: Fri, 19 Jul 2013 22:09:16 +0200	[thread overview]
Message-ID: <51E99CEC.3010404@redhat.com> (raw)
In-Reply-To: <20130719184124.15864.20803.stgit@bling.home>

Il 19/07/2013 20:42, Alex Williamson ha scritto:
> if mr->size == 0, then
> 
> int128_get64(int128_sub(mr->size, int128_make64(1))) => assert(!a.hi)
> 
> Also, use int128_one().
> 
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

> ---
>  memory.c |    8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/memory.c b/memory.c
> index c8f9a2b..6e17c21 100644
> --- a/memory.c
> +++ b/memory.c
> @@ -1788,7 +1788,9 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
>                     "-" TARGET_FMT_plx "\n",
>                     base + mr->addr,
>                     base + mr->addr
> -                   + (hwaddr)int128_get64(int128_sub(mr->size, int128_make64(1))),
> +                   + (int128_nz(mr->size) ?
> +                      (hwaddr)int128_get64(int128_sub(mr->size,
> +                                                      int128_one())) : 0),
>                     mr->priority,
>                     mr->romd_mode ? 'R' : '-',
>                     !mr->readonly && !(mr->rom_device && mr->romd_mode) ? 'W'
> @@ -1803,7 +1805,9 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f,
>                     TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %c%c): %s\n",
>                     base + mr->addr,
>                     base + mr->addr
> -                   + (hwaddr)int128_get64(int128_sub(mr->size, int128_make64(1))),
> +                   + (int128_nz(mr->size) ?
> +                      (hwaddr)int128_get64(int128_sub(mr->size,
> +                                                      int128_one())) : 0),
>                     mr->priority,
>                     mr->romd_mode ? 'R' : '-',
>                     !mr->readonly && !(mr->rom_device && mr->romd_mode) ? 'W'
> 

  reply	other threads:[~2013-07-19 20:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 18:42 [Qemu-devel] [PATCH] memory: Fix zero-sized memory region print Alex Williamson
2013-07-19 20:09 ` Paolo Bonzini [this message]
2013-07-23 19:04 ` Anthony Liguori

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=51E99CEC.3010404@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.williamson@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).