From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Huth Subject: Re: [kvm-unit-tests PATCH v2 2/4] lib/alloc: fix format warnings, add/use PRIx64 Date: Thu, 3 Mar 2016 10:28:15 +0100 Message-ID: <56D803AF.4050508@redhat.com> References: <1456942034-21005-1-git-send-email-drjones@redhat.com> <1456942034-21005-3-git-send-email-drjones@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: pbonzini@redhat.com, rkrcmar@redhat.com To: Andrew Jones , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44601 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755553AbcCCJ2T (ORCPT ); Thu, 3 Mar 2016 04:28:19 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 5EF54C00B8F1 for ; Thu, 3 Mar 2016 09:28:18 +0000 (UTC) In-Reply-To: <1456942034-21005-3-git-send-email-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 02.03.2016 19:07, Andrew Jones wrote: > Signed-off-by: Andrew Jones > --- > lib/alloc.c | 13 +++++++------ > lib/libcflat.h | 12 ++++++++++++ > 2 files changed, 19 insertions(+), 6 deletions(-) > > diff --git a/lib/alloc.c b/lib/alloc.c > index 34f71a337d868..e345843b7fe53 100644 > --- a/lib/alloc.c > +++ b/lib/alloc.c > @@ -28,13 +28,13 @@ void phys_alloc_show(void) > int i; > > spin_lock(&lock); > - printf("phys_alloc minimum alignment: 0x%llx\n", align_min); > + printf("phys_alloc minimum alignment: 0x%" PRIx64 "\n", align_min); > for (i = 0; i < nr_regions; ++i) > - printf("%016llx-%016llx [%s]\n", > + printf("%016" PRIx64 "-%016" PRIx64 " [%s]\n", > regions[i].base, > regions[i].base + regions[i].size - 1, > "USED"); > - printf("%016llx-%016llx [%s]\n", base, top - 1, "FREE"); > + printf("%016" PRIx64 "-%016" PRIx64 " [%s]\n", base, top - 1, "FREE"); > spin_unlock(&lock); > } > > @@ -76,9 +76,10 @@ static phys_addr_t phys_alloc_aligned_safe(phys_addr_t size, > size += addr - base; > > if ((top_safe - base) < size) { > - printf("phys_alloc: requested=0x%llx (align=0x%llx), " > - "need=0x%llx, but free=0x%llx. " > - "top=0x%llx, top_safe=0x%llx\n", > + printf("phys_alloc: requested=0x%" PRIx64 > + " (align=0x%" PRIx64 "), " > + "need=0x%" PRIx64 ", but free=0x%" PRIx64 ". " > + "top=0x%" PRIx64 ", top_safe=0x%" PRIx64 "\n", > size_orig, align, size, top_safe - base, > top, top_safe); > spin_unlock(&lock); So as far as I can see, the related variables (align_min et al.) are of type phys_addr_t. And phys_addr_t is defined like this: #ifdef PHYS32 typedef u32 phys_addr_t; #else typedef u64 phys_addr_t; #endif So it looks like these variables also could be 32-bit in some cases ... currently nobody seems to define PHYS32, so your patch should be safe for now, but in case somebody ever tries to compile with PHYS32 defined again, this will break. Maybe it would be better to cast the variables instead of using PRIx64 here, something like: printf("phys_alloc minimum alignment: 0x%llx\n", (long long)align_min); ? Thomas