From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53139) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOnFH-0005t9-QF for qemu-devel@nongnu.org; Wed, 25 Sep 2013 07:27:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VOnFB-0003tk-Ml for qemu-devel@nongnu.org; Wed, 25 Sep 2013 07:27:03 -0400 Received: from mail-qe0-x229.google.com ([2607:f8b0:400d:c02::229]:60990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VOnFB-0003tZ-Ig for qemu-devel@nongnu.org; Wed, 25 Sep 2013 07:26:57 -0400 Received: by mail-qe0-f41.google.com with SMTP id 1so4109191qee.28 for ; Wed, 25 Sep 2013 04:26:57 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5242C88F.4080803@redhat.com> Date: Wed, 25 Sep 2013 13:27:11 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1377850238-10270-1-git-send-email-aik@ozlabs.ru> In-Reply-To: <1377850238-10270-1-git-send-email-aik@ozlabs.ru> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] memory: fix 128 arithmetic in info mtree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: qemu-devel@nongnu.org Il 30/08/2013 10:10, Alexey Kardashevskiy ha scritto: > mtree_print_mr() calls int128_get64() in 3 places but only 2 places > handle 2^64 correctly. > > This fixes the third call of int128_get64(). > > Signed-off-by: Alexey Kardashevskiy > --- > memory.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/memory.c b/memory.c > index ffedde7..93f2995 100644 > --- a/memory.c > +++ b/memory.c > @@ -1816,7 +1816,9 @@ static void mtree_print_mr(fprintf_function mon_printf, void *f, > mr->alias->name, > mr->alias_offset, > mr->alias_offset > - + (hwaddr)int128_get64(mr->size) - 1); > + + (int128_nz(mr->size) ? > + (hwaddr)int128_get64(int128_sub(mr->size, > + int128_one())) : 0)); > } else { > mon_printf(f, > TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %c%c): %s\n", > Applied to my iommu branch, which I should eventually rename. :) Thanks, Paolo