All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: kvm@vger.kernel.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: [kvm-unit-tests PATCH 1/6] fix conversions in report()s
Date: Wed, 17 May 2017 22:14:00 +0200	[thread overview]
Message-ID: <20170517201405.19867-2-rkrcmar@redhat.com> (raw)
In-Reply-To: <20170517201405.19867-1-rkrcmar@redhat.com>

Fix conversions that would trigger a warning if the format was checked
by a compiler.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 arm/selftest.c        | 2 +-
 powerpc/selftest.c    | 2 +-
 powerpc/spapr_hcall.c | 2 +-
 x86/asyncpf.c         | 6 +++---
 x86/hyperv_synic.c    | 2 +-
 x86/tsc.c             | 2 +-
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/arm/selftest.c b/arm/selftest.c
index 750e90893141..f305f4e3be19 100644
--- a/arm/selftest.c
+++ b/arm/selftest.c
@@ -37,7 +37,7 @@ static void check_setup(int argc, char **argv)
 			phys_addr_t memsize = PHYS_END - PHYS_OFFSET;
 			phys_addr_t expected = ((phys_addr_t)val)*1024*1024;
 
-			report("size = %d MB", memsize == expected,
+			report("size = %" PRIu64 " MB", memsize == expected,
 							memsize/1024/1024);
 			++nr_tests;
 
diff --git a/powerpc/selftest.c b/powerpc/selftest.c
index 8c5ff0ac889d..4e29fd6bbd56 100644
--- a/powerpc/selftest.c
+++ b/powerpc/selftest.c
@@ -28,7 +28,7 @@ static void check_setup(int argc, char **argv)
 			phys_addr_t memsize = PHYSICAL_END - PHYSICAL_START;
 			phys_addr_t expected = ((phys_addr_t)val)*1024*1024;
 
-			report("size = %d MB", memsize == expected,
+			report("size = %" PRIu64 " MB", memsize == expected,
 							memsize/1024/1024);
 			++nr_tests;
 
diff --git a/powerpc/spapr_hcall.c b/powerpc/spapr_hcall.c
index 656aaff61405..bd6c287a2f0c 100644
--- a/powerpc/spapr_hcall.c
+++ b/powerpc/spapr_hcall.c
@@ -49,7 +49,7 @@ static void test_h_set_sprg0(int argc, char **argv)
 
 	rc = hcall(H_SET_SPRG0, sprg0_orig);
 	sprg0 = mfspr(SPR_SPRG0);
-	report("sprg0 = 0x%llx",
+	report("sprg0 = 0x%" PRIx64,
 		rc == H_SUCCESS && sprg0 == sprg0_orig, sprg0_orig);
 }
 
diff --git a/x86/asyncpf.c b/x86/asyncpf.c
index e29e07c556f3..fea1d28ef375 100644
--- a/x86/asyncpf.c
+++ b/x86/asyncpf.c
@@ -52,13 +52,13 @@ static void pf_isr(struct ex_regs *r)
 
 	switch (reason) {
 		case 0:
-			report("unexpected #PF at %p", false, read_cr2());
+			report("unexpected #PF at 0x%lx", false, read_cr2());
 			break;
 		case KVM_PV_REASON_PAGE_NOT_PRESENT:
 			phys = virt_to_phys_cr3(virt);
 			install_pte(phys_to_virt(read_cr3()), 1, virt, phys, 0);
 			write_cr3(read_cr3());
-			report("Got not present #PF token %x virt addr %p phys addr %p",
+			report("Got not present #PF token %lx virt addr %p phys addr 0x%" PRIx64,
 					true, read_cr2(), virt, phys);
 			while(phys) {
 				safe_halt(); /* enables irq */
@@ -66,7 +66,7 @@ static void pf_isr(struct ex_regs *r)
 			}
 			break;
 		case KVM_PV_REASON_PAGE_READY:
-			report("Got present #PF token %x", true, read_cr2());
+			report("Got present #PF token %lx", true, read_cr2());
 			if ((uint32_t)read_cr2() == ~0)
 				break;
 			install_pte(phys_to_virt(read_cr3()), 1, virt, phys | PT_PRESENT_MASK | PT_WRITABLE_MASK, 0);
diff --git a/x86/hyperv_synic.c b/x86/hyperv_synic.c
index 74bbd58ee983..d1f75c588e1c 100644
--- a/x86/hyperv_synic.c
+++ b/x86/hyperv_synic.c
@@ -90,7 +90,7 @@ static void synic_test_prepare(void *ctx)
     }
     r = rdmsr(HV_X64_MSR_EOM);
     if (r != 0) {
-        report("Hyper-V SynIC test, EOM read 0x%llx", false, r);
+        report("Hyper-V SynIC test, EOM read 0x%" PRIx64, false, r);
         goto ret;
     }
 
diff --git a/x86/tsc.c b/x86/tsc.c
index 62450e71725c..6dc05af27eaf 100644
--- a/x86/tsc.c
+++ b/x86/tsc.c
@@ -23,7 +23,7 @@ void test_rdtscp(u64 aux)
 
        wrmsr(MSR_TSC_AUX, aux);
        rdtscp(&ecx);
-       report("Test RDTSCP %d", ecx == aux, aux);
+       report("Test RDTSCP %" PRIu64, ecx == aux, aux);
 }
 
 int main()
-- 
2.13.0

  reply	other threads:[~2017-05-17 20:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17 20:13 [kvm-unit-tests PATCH 0/6] improve report/printf formatting Radim Krčmář
2017-05-17 20:14 ` Radim Krčmář [this message]
2017-05-18  2:34   ` [kvm-unit-tests PATCH 1/6] fix conversions in report()s Thomas Huth
2017-05-18  8:03   ` David Hildenbrand
2017-05-17 20:14 ` [kvm-unit-tests PATCH 2/6] libcflat: add format checking to report() Radim Krčmář
2017-05-18  2:38   ` Thomas Huth
2017-05-17 20:14 ` [kvm-unit-tests PATCH 3/6] libcflat: fix padding in printf Radim Krčmář
2017-05-17 20:14 ` [kvm-unit-tests PATCH 4/6] pci-edu: remove 0x before a decimal value Radim Krčmář
2017-05-18  2:39   ` Thomas Huth
2017-05-17 20:14 ` [kvm-unit-tests PATCH 5/6] libcflat: support # flag in printf Radim Krčmář
2017-05-17 20:14 ` [kvm-unit-tests PATCH 6/6] use %# instead of 0x% in all format strings Radim Krčmář
2017-05-18 16:04 ` [kvm-unit-tests PATCH 0/6] improve report/printf formatting Paolo Bonzini

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=20170517201405.19867-2-rkrcmar@redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.