All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH 0/6] improve report/printf formatting
@ 2017-05-17 20:13 Radim Krčmář
  2017-05-17 20:14 ` [kvm-unit-tests PATCH 1/6] fix conversions in report()s Radim Krčmář
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Radim Krčmář @ 2017-05-17 20:13 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

This series is a mix of three logical units:

  [1-2/6]: add format checking to report() and fix revealed bugs

  [3/6]: fix padding in %p conversions

  [4-6/6]: fix random 0x%d and support %# to make this mistake harder


Radim Krčmář (6):
  fix conversions in report()s
  libcflat: add format checking to report()
  libcflat: fix padding in printf
  pci-edu: remove 0x before a decimal value
  libcflat: support # flag in printf
  use %# instead of 0x% in all format strings

 arm/pmu.c               |  2 +-
 arm/selftest.c          |  2 +-
 lib/alloc.c             | 10 +++++-----
 lib/arm64/processor.c   |  6 +++---
 lib/libcflat.h          | 18 ++++++++++++------
 lib/pci-edu.c           |  2 +-
 lib/pci.c               |  6 +++---
 lib/powerpc/processor.c |  2 +-
 lib/printf.c            | 20 ++++++++++++++++++--
 lib/x86/desc.c          |  2 +-
 lib/x86/intel-iommu.c   | 16 ++++++++--------
 lib/x86/vm.c            |  4 ++--
 powerpc/emulator.c      |  4 ++--
 powerpc/selftest.c      |  2 +-
 powerpc/spapr_hcall.c   |  2 +-
 powerpc/sprs.c          |  4 ++--
 x86/asyncpf.c           |  6 +++---
 x86/hyperv_synic.c      |  2 +-
 x86/msr.c               |  4 ++--
 x86/tsc.c               |  2 +-
 x86/vmexit.c            |  2 +-
 x86/vmx.c               | 14 +++++++-------
 x86/vmx.h               |  4 ++--
 x86/vmx_tests.c         |  2 +-
 x86/xsave.c             |  2 +-
 25 files changed, 81 insertions(+), 59 deletions(-)

-- 
2.13.0

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [kvm-unit-tests PATCH 1/6] fix conversions in report()s
  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ář
  2017-05-18  2:34   ` 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ář
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 12+ messages in thread
From: Radim Krčmář @ 2017-05-17 20:14 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [kvm-unit-tests PATCH 2/6] libcflat: add format checking to report()
  2017-05-17 20:13 [kvm-unit-tests PATCH 0/6] improve report/printf formatting Radim Krčmář
  2017-05-17 20:14 ` [kvm-unit-tests PATCH 1/6] fix conversions in report()s Radim Krčmář
@ 2017-05-17 20:14 ` 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ář
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Radim Krčmář @ 2017-05-17 20:14 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

report() is a wrapper for printf(), but the compiler was not aware.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 lib/libcflat.h | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/lib/libcflat.h b/lib/libcflat.h
index b1ea5e607033..a5c42903b11f 100644
--- a/lib/libcflat.h
+++ b/lib/libcflat.h
@@ -96,14 +96,20 @@ extern int vsnprintf(char *buf, int size, const char *fmt, va_list va)
 extern int vprintf(const char *fmt, va_list va)
 					__attribute__((format(printf, 1, 0)));
 
-void report_prefix_pushf(const char *prefix_fmt, ...);
+void report_prefix_pushf(const char *prefix_fmt, ...)
+					__attribute__((format(printf, 1, 2)));
 extern void report_prefix_push(const char *prefix);
 extern void report_prefix_pop(void);
-extern void report(const char *msg_fmt, bool pass, ...);
-extern void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...);
-extern void report_abort(const char *msg_fmt, ...);
-extern void report_skip(const char *msg_fmt, ...);
-extern void report_info(const char *msg_fmt, ...);
+extern void report(const char *msg_fmt, bool pass, ...)
+					__attribute__((format(printf, 1, 3)));
+extern void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...)
+					__attribute__((format(printf, 1, 4)));
+extern void report_abort(const char *msg_fmt, ...)
+					__attribute__((format(printf, 1, 2)));
+extern void report_skip(const char *msg_fmt, ...)
+					__attribute__((format(printf, 1, 2)));
+extern void report_info(const char *msg_fmt, ...)
+					__attribute__((format(printf, 1, 2)));
 extern void report_pass(void);
 extern int report_summary(void);
 
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [kvm-unit-tests PATCH 3/6] libcflat: fix padding in printf
  2017-05-17 20:13 [kvm-unit-tests PATCH 0/6] improve report/printf formatting Radim Krčmář
  2017-05-17 20:14 ` [kvm-unit-tests PATCH 1/6] fix conversions in report()s Radim Krčmář
  2017-05-17 20:14 ` [kvm-unit-tests PATCH 2/6] libcflat: add format checking to report() Radim Krčmář
@ 2017-05-17 20:14 ` 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ář
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Radim Krčmář @ 2017-05-17 20:14 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

A simple test:

  printf(".%8p.\n",  (void *)0);
  printf(".%-8p.\n", (void *)0);
  printf(".%8p.\n",  (void *)1);
  printf(".%-8p.\n", (void *)1);
  printf(".%8p.\n",  (void *)0x123456);
  printf(".%-8p.\n", (void *)0x123456);

  printf(".%2p.\n",  (void *)0);
  printf(".%-2p.\n", (void *)0);
  printf(".%2p.\n",  (void *)1);
  printf(".%-2p.\n", (void *)1);

glibc:

  .   (nil).
  .(nil)   .
  .     0x1.
  .0x1     .
  .0x123456.
  .0x123456.
  .(nil).
  .(nil).
  .0x1.
  .0x1.

before patch:

  .      0x       0.
  .0x      0       .
  .      0x       1.
  .0x      1       .
  .      0x  123456.
  .0x      123456  .
  .0x 0.
  .0x0 .
  .0x 1.
  .0x1 .

after patch:

  .       0.
  .0       .
  .     0x1.
  .0x1     .
  .0x123456.
  .0x123456.
  . 0.
  .0 .
  .0x1.
  .0x1.

(nil) would be possible with a small change, but the standard leaves it
to the implementation and 0 is acceptable, IMO.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 lib/printf.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/printf.c b/lib/printf.c
index e7818e1ded0e..944768f3080d 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -18,6 +18,7 @@ typedef struct pstream {
 typedef struct strprops {
     char pad;
     int npad;
+    bool alternate;
 } strprops_t;
 
 static void addchar(pstream_t *p, char c)
@@ -94,7 +95,7 @@ void print_int(pstream_t *ps, long long n, int base, strprops_t props)
 void print_unsigned(pstream_t *ps, unsigned long long n, int base,
 		    strprops_t props)
 {
-    char buf[sizeof(long) * 3 + 1], *p = buf;
+    char buf[sizeof(long) * 3 + 3], *p = buf;
     int i;
 
     while (n) {
@@ -104,6 +105,10 @@ void print_unsigned(pstream_t *ps, unsigned long long n, int base,
 
     if (p == buf)
 	*p++ = '0';
+    else if (props.alternate && base == 16) {
+	*p++ = 'x';
+	*p++ = '0';
+    }
 
     for (i = 0; i < (p - buf) / 2; ++i) {
 	char tmp;
@@ -225,7 +230,7 @@ int vsnprintf(char *buf, int size, const char *fmt, va_list va)
 	    }
 	    break;
 	case 'p':
-	    print_str(&s, "0x", props);
+	    props.alternate = true;
 	    print_unsigned(&s, (unsigned long)va_arg(va, void *), 16, props);
 	    break;
 	case 's':
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [kvm-unit-tests PATCH 4/6] pci-edu: remove 0x before a decimal value
  2017-05-17 20:13 [kvm-unit-tests PATCH 0/6] improve report/printf formatting Radim Krčmář
                   ` (2 preceding siblings ...)
  2017-05-17 20:14 ` [kvm-unit-tests PATCH 3/6] libcflat: fix padding in printf Radim Krčmář
@ 2017-05-17 20:14 ` 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ář
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Radim Krčmář @ 2017-05-17 20:14 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 lib/pci-edu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/pci-edu.c b/lib/pci-edu.c
index f94962f0001a..58ce0b56554d 100644
--- a/lib/pci-edu.c
+++ b/lib/pci-edu.c
@@ -48,7 +48,7 @@ void edu_dma(struct pci_edu_dev *dev, iova_t iova,
 	assert(size <= EDU_DMA_SIZE_MAX);
 	assert(dev_offset < EDU_DMA_SIZE_MAX);
 
-	printf("edu device DMA start %s addr 0x%" PRIx64 " size 0x%lu off 0x%x\n",
+	printf("edu device DMA start %s addr 0x%" PRIx64 " size %lu off 0x%x\n",
 	       from_device ? "FROM" : "TO",
 	       iova, (ulong)size, dev_offset);
 
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [kvm-unit-tests PATCH 5/6] libcflat: support # flag in printf
  2017-05-17 20:13 [kvm-unit-tests PATCH 0/6] improve report/printf formatting Radim Krčmář
                   ` (3 preceding siblings ...)
  2017-05-17 20:14 ` [kvm-unit-tests PATCH 4/6] pci-edu: remove 0x before a decimal value Radim Krčmář
@ 2017-05-17 20:14 ` 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
  6 siblings, 0 replies; 12+ messages in thread
From: Radim Krčmář @ 2017-05-17 20:14 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

The only use is with %#x, where we'll automatically get 0x prefix.
Advantage over 0x%x can be seen with padding.

A simple test:

  printf(".%#08x.\n", 0);
  printf(".%#8x.\n",  0);
  printf(".%#-8x.\n", 0);

  printf(".%#08x.\n", 1);
  printf(".%#8x.\n",  1);
  printf(".%#-8x.\n", 1);

  printf(".%#08x.\n", 0x123456);
  printf(".%#8x.\n",  0x123456);
  printf(".%#-8x.\n", 0x123456);

  printf(".%#02x.\n", 0);
  printf(".%#2x.\n",  0);
  printf(".%#-2x.\n", 0);

  printf(".%#02x.\n", 1);
  printf(".%#2x.\n",  1);
  printf(".%#-2x.\n", 1);

looks just like glibc:

  .00000000.
  .       0.
  .0       .
  .0x000001.
  .     0x1.
  .0x1     .
  .0x123456.
  .0x123456.
  .0x123456.
  .00.
  . 0.
  .0 .
  .0x1.
  .0x1.
  .0x1.

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 lib/printf.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/lib/printf.c b/lib/printf.c
index 944768f3080d..bfe05f573f08 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -106,8 +106,16 @@ void print_unsigned(pstream_t *ps, unsigned long long n, int base,
     if (p == buf)
 	*p++ = '0';
     else if (props.alternate && base == 16) {
-	*p++ = 'x';
-	*p++ = '0';
+	if (props.pad == '0') {
+	    addchar(ps, '0');
+	    addchar(ps, 'x');
+
+	    if (props.npad > 0)
+		props.npad = MAX(props.npad - 2, 0);
+	} else {
+	    *p++ = 'x';
+	    *p++ = '0';
+	}
     }
 
     for (i = 0; i < (p - buf) / 2; ++i) {
@@ -169,6 +177,9 @@ int vsnprintf(char *buf, int size, const char *fmt, va_list va)
 	case '\0':
 	    --fmt;
 	    break;
+	case '#':
+	    props.alternate = true;
+	    goto morefmt;
 	case '0':
 	    props.pad = '0';
 	    ++fmt;
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [kvm-unit-tests PATCH 6/6] use %# instead of 0x% in all format strings
  2017-05-17 20:13 [kvm-unit-tests PATCH 0/6] improve report/printf formatting Radim Krčmář
                   ` (4 preceding siblings ...)
  2017-05-17 20:14 ` [kvm-unit-tests PATCH 5/6] libcflat: support # flag in printf Radim Krčmář
@ 2017-05-17 20:14 ` Radim Krčmář
  2017-05-18 16:04 ` [kvm-unit-tests PATCH 0/6] improve report/printf formatting Paolo Bonzini
  6 siblings, 0 replies; 12+ messages in thread
From: Radim Krčmář @ 2017-05-17 20:14 UTC (permalink / raw)
  To: kvm; +Cc: Paolo Bonzini

It's one character shorter, properly prefixed, and also provides error
detection: %#d triggers a warning.

Done with `sed -i 's/0x%/%#/g' **/*.[ch]` to motivate the use of %#,
existing padding was raised by 2 to account for the counted "0x" (output
should be the same).

Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 arm/pmu.c               |  2 +-
 lib/alloc.c             | 10 +++++-----
 lib/arm64/processor.c   |  6 +++---
 lib/pci-edu.c           |  2 +-
 lib/pci.c               |  6 +++---
 lib/powerpc/processor.c |  2 +-
 lib/x86/desc.c          |  2 +-
 lib/x86/intel-iommu.c   | 16 ++++++++--------
 lib/x86/vm.c            |  4 ++--
 powerpc/emulator.c      |  4 ++--
 powerpc/spapr_hcall.c   |  2 +-
 powerpc/sprs.c          |  4 ++--
 x86/asyncpf.c           |  4 ++--
 x86/hyperv_synic.c      |  2 +-
 x86/msr.c               |  4 ++--
 x86/vmexit.c            |  2 +-
 x86/vmx.c               | 14 +++++++-------
 x86/vmx.h               |  4 ++--
 x86/vmx_tests.c         |  2 +-
 x86/xsave.c             |  2 +-
 20 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/arm/pmu.c b/arm/pmu.c
index c4d5c97dbf87..74848988a678 100644
--- a/arm/pmu.c
+++ b/arm/pmu.c
@@ -153,7 +153,7 @@ static bool check_pmcr(void)
 
 	pmcr = get_pmcr();
 
-	report_info("PMU implementer/ID code/counters: 0x%x(\"%c\")/0x%x/%d",
+	report_info("PMU implementer/ID code/counters: %#x(\"%c\")/%#x/%d",
 		    (pmcr >> PMU_PMCR_IMP_SHIFT) & PMU_PMCR_IMP_MASK,
 		    ((pmcr >> PMU_PMCR_IMP_SHIFT) & PMU_PMCR_IMP_MASK) ? : ' ',
 		    (pmcr >> PMU_PMCR_ID_SHIFT) & PMU_PMCR_ID_MASK,
diff --git a/lib/alloc.c b/lib/alloc.c
index 58af52b360f4..d553a7ec4e1f 100644
--- a/lib/alloc.c
+++ b/lib/alloc.c
@@ -25,7 +25,7 @@ void phys_alloc_show(void)
 	int i;
 
 	spin_lock(&lock);
-	printf("phys_alloc minimum alignment: 0x%" PRIx64 "\n",
+	printf("phys_alloc minimum alignment: %#" PRIx64 "\n",
 		(u64)align_min);
 	for (i = 0; i < nr_regions; ++i)
 		printf("%016" PRIx64 "-%016" PRIx64 " [%s]\n",
@@ -75,10 +75,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%" PRIx64
-		       " (align=0x%" PRIx64 "), "
-		       "need=0x%" PRIx64 ", but free=0x%" PRIx64 ". "
-		       "top=0x%" PRIx64 ", top_safe=0x%" PRIx64 "\n",
+		printf("phys_alloc: requested=%#" PRIx64
+		       " (align=%#" PRIx64 "), "
+		       "need=%#" PRIx64 ", but free=%#" PRIx64 ". "
+		       "top=%#" PRIx64 ", top_safe=%#" PRIx64 "\n",
 		       (u64)size_orig, (u64)align, (u64)size, top_safe - base,
 		       (u64)top, top_safe);
 		spin_unlock(&lock);
diff --git a/lib/arm64/processor.c b/lib/arm64/processor.c
index deeab4ec9c8a..165980a97d44 100644
--- a/lib/arm64/processor.c
+++ b/lib/arm64/processor.c
@@ -114,14 +114,14 @@ static void bad_exception(enum vector v, struct pt_regs *regs,
 			printf("Got bad vector=%d\n", v);
 	} else if (esr_valid) {
 		if (ec_names[ec])
-			printf("Unhandled exception ec=0x%x (%s)\n", ec,
+			printf("Unhandled exception ec=%#x (%s)\n", ec,
 					ec_names[ec]);
 		else
-			printf("Got bad ec=0x%x\n", ec);
+			printf("Got bad ec=%#x\n", ec);
 	}
 
 	printf("Vector: %d (%s)\n", v, vector_names[v]);
-	printf("ESR_EL1: %8s%08x, ec=0x%x (%s)\n", "", esr, ec, ec_names[ec]);
+	printf("ESR_EL1: %8s%08x, ec=%#x (%s)\n", "", esr, ec, ec_names[ec]);
 	printf("FAR_EL1: %016lx (%svalid)\n", far, far_valid ? "" : "not ");
 	printf("Exception frame registers:\n");
 	show_regs(regs);
diff --git a/lib/pci-edu.c b/lib/pci-edu.c
index 58ce0b56554d..0e0310545f2b 100644
--- a/lib/pci-edu.c
+++ b/lib/pci-edu.c
@@ -48,7 +48,7 @@ void edu_dma(struct pci_edu_dev *dev, iova_t iova,
 	assert(size <= EDU_DMA_SIZE_MAX);
 	assert(dev_offset < EDU_DMA_SIZE_MAX);
 
-	printf("edu device DMA start %s addr 0x%" PRIx64 " size %lu off 0x%x\n",
+	printf("edu device DMA start %s addr %#" PRIx64 " size %lu off %#x\n",
 	       from_device ? "FROM" : "TO",
 	       iova, (ulong)size, dev_offset);
 
diff --git a/lib/pci.c b/lib/pci.c
index bbd576344049..daa33e1fd4c2 100644
--- a/lib/pci.c
+++ b/lib/pci.c
@@ -49,7 +49,7 @@ bool pci_setup_msi(struct pci_dev *dev, uint64_t msi_addr, uint32_t msi_data)
 	assert(dev);
 
 	if (!dev->msi_offset) {
-		printf("MSI: dev 0x%x does not support MSI.\n", dev->bdf);
+		printf("MSI: dev %#x does not support MSI.\n", dev->bdf);
 		return false;
 	}
 
@@ -295,10 +295,10 @@ static void pci_cap_print(struct pci_dev *dev, int cap_offset, int cap_id)
 		break;
 	}
 	default:
-		printf("\tcapability 0x%02x ", cap_id);
+		printf("\tcapability %#04x ", cap_id);
 		break;
 	}
-	printf("at offset 0x%02x\n", cap_offset);
+	printf("at offset %#04x\n", cap_offset);
 }
 
 void pci_dev_print(struct pci_dev *dev)
diff --git a/lib/powerpc/processor.c b/lib/powerpc/processor.c
index 8910f24f1674..ec85b9d854e9 100644
--- a/lib/powerpc/processor.c
+++ b/lib/powerpc/processor.c
@@ -38,7 +38,7 @@ void do_handle_exception(struct pt_regs *regs)
 		return;
 	}
 
-	printf("unhandled cpu exception 0x%lx\n", regs->trap);
+	printf("unhandled cpu exception %#lx\n", regs->trap);
 	abort();
 }
 
diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index 402204ddcac4..4747b32e1248 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -69,7 +69,7 @@ static void unhandled_exception(struct ex_regs *regs, bool cpu)
 	       cpu ? "cpu " : "", regs->vector,
 	       exception_mnemonic(regs->vector), regs->rip);
 	if (regs->vector == 14)
-		printf("PF at 0x%lx addr 0x%lx\n", regs->rip, read_cr2());
+		printf("PF at %#lx addr %#lx\n", regs->rip, read_cr2());
 
 	printf("error_code=%04lx      rflags=%08lx      cs=%08lx\n"
 	       "rax=%016lx rcx=%016lx rdx=%016lx rbx=%016lx\n"
diff --git a/lib/x86/intel-iommu.c b/lib/x86/intel-iommu.c
index 7cc5a702aed4..9fdbd3bac6d1 100644
--- a/lib/x86/intel-iommu.c
+++ b/lib/x86/intel-iommu.c
@@ -115,9 +115,9 @@ static void vtd_dump_init_info(void)
 	/* Major version >= 1 */
 	assert(((version >> 3) & 0xf) >= 1);
 
-	printf("VT-d version:   0x%x\n", version);
-	printf("     cap:       0x%016lx\n", vtd_readq(DMAR_CAP_REG));
-	printf("     ecap:      0x%016lx\n", vtd_readq(DMAR_ECAP_REG));
+	printf("VT-d version:   %#x\n", version);
+	printf("     cap:       %#018lx\n", vtd_readq(DMAR_CAP_REG));
+	printf("     ecap:      %#018lx\n", vtd_readq(DMAR_ECAP_REG));
 }
 
 static void vtd_setup_root_table(void)
@@ -127,7 +127,7 @@ static void vtd_setup_root_table(void)
 	memset(root, 0, PAGE_SIZE);
 	vtd_writeq(DMAR_RTADDR_REG, virt_to_phys(root));
 	vtd_gcmd_or(VTD_GCMD_ROOT);
-	printf("DMAR table address: 0x%016lx\n", vtd_root_table());
+	printf("DMAR table address: %#018lx\n", vtd_root_table());
 }
 
 static void vtd_setup_ir_table(void)
@@ -138,7 +138,7 @@ static void vtd_setup_ir_table(void)
 	/* 0xf stands for table size (2^(0xf+1) == 65536) */
 	vtd_writeq(DMAR_IRTA_REG, virt_to_phys(root) | 0xf);
 	vtd_gcmd_or(VTD_GCMD_IR_TABLE);
-	printf("IR table address: 0x%016lx\n", vtd_ir_table());
+	printf("IR table address: %#018lx\n", vtd_ir_table());
 }
 
 static void vtd_install_pte(vtd_pte_t *root, iova_t iova,
@@ -219,14 +219,14 @@ void vtd_map_range(uint16_t sid, iova_t iova, phys_addr_t pa, size_t size)
 		ce->present = 1;
 		/* No error reporting yet */
 		ce->disable_fault_report = 1;
-		printf("allocated vt-d context entry for devfn 0x%x\n",
+		printf("allocated vt-d context entry for devfn %#x\n",
 		       devfn);
 	} else
 		slptptr = phys_to_virt(ce->slptptr << VTD_PAGE_SHIFT);
 
 	while (size) {
 		/* TODO: currently we only map 4K pages (level = 1) */
-		printf("map 4K page IOVA 0x%lx to 0x%lx (sid=0x%04x)\n",
+		printf("map 4K page IOVA %#lx to %#lx (sid=%#06x)\n",
 		       iova, pa, sid);
 		vtd_install_pte(slptptr, iova, pa, 1);
 		size -= VTD_PAGE_SIZE;
@@ -324,7 +324,7 @@ bool vtd_setup_msi(struct pci_dev *dev, int vector, int dest_id)
 	msi_addr.head = 0xfee;
 	msi_data.subhandle = 0;
 
-	printf("%s: msi_addr=0x%" PRIx64 ", msi_data=0x%x\n", __func__,
+	printf("%s: msi_addr=%#" PRIx64 ", msi_data=%#x\n", __func__,
 		*(uint64_t *)&msi_addr, *(uint32_t *)&msi_data);
 
 	return pci_setup_msi(dev, *(uint64_t *)&msi_addr,
diff --git a/lib/x86/vm.c b/lib/x86/vm.c
index d52bb53fcf5e..9b5f9220aa8b 100644
--- a/lib/x86/vm.c
+++ b/lib/x86/vm.c
@@ -12,10 +12,10 @@ static void free_memory(void *mem, unsigned long size)
 	assert_msg((unsigned long) mem % PAGE_SIZE == 0,
 		   "mem not page aligned: %p", mem);
 
-	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: 0x%lx", size);
+	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: %#lx", size);
 
 	assert_msg(size == 0 || mem + size > mem,
-		   "mem + size overflow: %p + 0x%lx", mem, size);
+		   "mem + size overflow: %p + %#lx", mem, size);
 
 	if (size == 0) {
 		free = NULL;
diff --git a/powerpc/emulator.c b/powerpc/emulator.c
index 04c448014ae9..a7f454e02226 100644
--- a/powerpc/emulator.c
+++ b/powerpc/emulator.c
@@ -14,7 +14,7 @@ static void program_check_handler(struct pt_regs *regs, void *opaque)
 	int *data = opaque;
 
 	if (verbose) {
-		printf("Detected invalid instruction 0x%016lx: %08x\n",
+		printf("Detected invalid instruction %#018lx: %08x\n",
 		       regs->nip, *(uint32_t*)regs->nip);
 	}
 
@@ -36,7 +36,7 @@ static void alignment_handler(struct pt_regs *regs, void *opaque)
 	int *data = opaque;
 
 	if (verbose) {
-		printf("Detected alignment exception 0x%016lx: %08x\n",
+		printf("Detected alignment exception %#018lx: %08x\n",
 		       regs->nip, *(uint32_t*)regs->nip);
 	}
 
diff --git a/powerpc/spapr_hcall.c b/powerpc/spapr_hcall.c
index bd6c287a2f0c..ce495f45ca94 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%" PRIx64,
+	report("sprg0 = %#" PRIx64,
 		rc == H_SUCCESS && sprg0 == sprg0_orig, sprg0_orig);
 }
 
diff --git a/powerpc/sprs.c b/powerpc/sprs.c
index 9227eff9d81a..39644fab9b70 100644
--- a/powerpc/sprs.c
+++ b/powerpc/sprs.c
@@ -271,7 +271,7 @@ int main(int argc, char **argv)
 		}
 	}
 
-	printf("Settings SPRs to 0x%lx...\n", pat);
+	printf("Settings SPRs to %#lx...\n", pat);
 	set_sprs(pat);
 
 	memset(before, 0, sizeof(before));
@@ -296,7 +296,7 @@ int main(int argc, char **argv)
 	puts("Checking SPRs...\n");
 	for (i = 0; i < 1024; i++) {
 		if (before[i] != 0 || after[i] != 0)
-			report("SPR %d:\t0x%016lx <==> 0x%016lx",
+			report("SPR %d:\t%#018lx <==> %#018lx",
 				before[i] == after[i], i, before[i], after[i]);
 	}
 
diff --git a/x86/asyncpf.c b/x86/asyncpf.c
index fea1d28ef375..f04d7cb5ad7a 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 0x%lx", false, read_cr2());
+			report("unexpected #PF at %#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 %lx virt addr %p phys addr 0x%" PRIx64,
+			report("Got not present #PF token %lx virt addr %p phys addr %#" PRIx64,
 					true, read_cr2(), virt, phys);
 			while(phys) {
 				safe_halt(); /* enables irq */
diff --git a/x86/hyperv_synic.c b/x86/hyperv_synic.c
index d1f75c588e1c..a08e69f7da5f 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%" PRIx64, false, r);
+        report("Hyper-V SynIC test, EOM read %#" PRIx64, false, r);
         goto ret;
     }
 
diff --git a/x86/msr.c b/x86/msr.c
index ded9424900eb..ab97d21d3acb 100644
--- a/x86/msr.c
+++ b/x86/msr.c
@@ -82,13 +82,13 @@ static void test_msr_rw(int msr_index, unsigned long long input, unsigned long l
     if ((index = find_msr_info(msr_index)) != -1) {
         sptr = msr_info[index].name;
     } else {
-        printf("couldn't find name for msr # 0x%x, skipping\n", msr_index);
+        printf("couldn't find name for msr # %#x, skipping\n", msr_index);
         return;
     }
     wrmsr(msr_index, input);
     r = rdmsr(msr_index);
     if (expected != r) {
-        printf("testing %s: output = 0x%x:0x%x expected = 0x%x:0x%x\n", sptr,
+        printf("testing %s: output = %#x:%#x expected = %#x:%#x\n", sptr,
                (u32)(r >> 32), (u32)r, (u32)(expected >> 32), (u32)expected);
     }
     report(sptr, expected == r);
diff --git a/x86/vmexit.c b/x86/vmexit.c
index 5b821b5eb125..8d2bf1a31982 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -524,7 +524,7 @@ int main(int ac, char **av)
 		membar = pcidev.resource[PCI_TESTDEV_BAR_MEM];
 		pci_test.memaddr = ioremap(membar, PAGE_SIZE);
 		pci_test.iobar = pcidev.resource[PCI_TESTDEV_BAR_IO];
-		printf("pci-testdev at 0x%x membar %lx iobar %x\n",
+		printf("pci-testdev at %#x membar %lx iobar %x\n",
 		       pcidev.bdf, membar, pci_test.iobar);
 	}
 
diff --git a/x86/vmx.c b/x86/vmx.c
index f7a34d20ab6a..13366180f514 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -521,16 +521,16 @@ void print_vmexit_info()
 	guest_rsp = vmcs_read(GUEST_RSP);
 	printf("VMEXIT info:\n");
 	printf("\tvmexit reason = %ld\n", reason);
-	printf("\texit qualification = 0x%lx\n", exit_qual);
+	printf("\texit qualification = %#lx\n", exit_qual);
 	printf("\tBit 31 of reason = %lx\n", (vmcs_read(EXI_REASON) >> 31) & 1);
-	printf("\tguest_rip = 0x%lx\n", guest_rip);
-	printf("\tRAX=0x%lx    RBX=0x%lx    RCX=0x%lx    RDX=0x%lx\n",
+	printf("\tguest_rip = %#lx\n", guest_rip);
+	printf("\tRAX=%#lx    RBX=%#lx    RCX=%#lx    RDX=%#lx\n",
 		regs.rax, regs.rbx, regs.rcx, regs.rdx);
-	printf("\tRSP=0x%lx    RBP=0x%lx    RSI=0x%lx    RDI=0x%lx\n",
+	printf("\tRSP=%#lx    RBP=%#lx    RSI=%#lx    RDI=%#lx\n",
 		guest_rsp, regs.rbp, regs.rsi, regs.rdi);
-	printf("\tR8 =0x%lx    R9 =0x%lx    R10=0x%lx    R11=0x%lx\n",
+	printf("\tR8 =%#lx    R9 =%#lx    R10=%#lx    R11=%#lx\n",
 		regs.r8, regs.r9, regs.r10, regs.r11);
-	printf("\tR12=0x%lx    R13=0x%lx    R14=0x%lx    R15=0x%lx\n",
+	printf("\tR12=%#lx    R13=%#lx    R14=%#lx    R15=%#lx\n",
 		regs.r12, regs.r13, regs.r14, regs.r15);
 }
 
@@ -553,7 +553,7 @@ print_vmentry_failure_info(struct vmentry_failure *failure) {
 		u64 reason = vmcs_read(EXI_REASON);
 		u64 qual = vmcs_read(EXI_QUALIFICATION);
 
-		printf("Non-early %s failure (reason=0x%lx, qual=0x%lx): ",
+		printf("Non-early %s failure (reason=%#lx, qual=%#lx): ",
 			failure->instr, reason, qual);
 
 		switch (reason & 0xff) {
diff --git a/x86/vmx.h b/x86/vmx.h
index 392979ba8ae8..787466653f8b 100644
--- a/x86/vmx.h
+++ b/x86/vmx.h
@@ -755,8 +755,8 @@ do { \
 		binstr(_a, _bin_a); \
 		binstr(_b, _bin_b); \
 		report("%s:%d: %s failed: (%s) == (%s)\n" \
-		       "\tLHS: 0x%016lx - %s - %lu\n" \
-		       "\tRHS: 0x%016lx - %s - %lu%s" fmt, 0, \
+		       "\tLHS: %#018lx - %s - %lu\n" \
+		       "\tRHS: %#018lx - %s - %lu%s" fmt, 0, \
 		       __FILE__, __LINE__, \
 		       assertion ? "Assertion" : "Expectation", a_str, b_str, \
 		       (unsigned long) _a, _bin_a, (unsigned long) _a, \
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 136cc30abf6f..1f439522cad8 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -719,7 +719,7 @@ static int iobmp_exit_handler()
 		vmcs_write(GUEST_RIP, guest_rip + insn_len);
 		return VMX_TEST_RESUME;
 	default:
-		printf("guest_rip = 0x%lx\n", guest_rip);
+		printf("guest_rip = %#lx\n", guest_rip);
 		printf("\tERROR : Undefined exit reason, reason = %ld.\n", reason);
 		break;
 	}
diff --git a/x86/xsave.c b/x86/xsave.c
index 52142d2cdb93..2d8ca7c2c510 100644
--- a/x86/xsave.c
+++ b/x86/xsave.c
@@ -75,7 +75,7 @@ void test_xsave(void)
     printf("Legal instruction testing:\n");
 
     supported_xcr0 = get_supported_xcr0();
-    printf("Supported XCR0 bits: 0x%lx\n", supported_xcr0);
+    printf("Supported XCR0 bits: %#lx\n", supported_xcr0);
 
     test_bits = XSTATE_FP | XSTATE_SSE;
     report("Check minimal XSAVE required bits",
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [kvm-unit-tests PATCH 1/6] fix conversions in report()s
  2017-05-17 20:14 ` [kvm-unit-tests PATCH 1/6] fix conversions in report()s Radim Krčmář
@ 2017-05-18  2:34   ` Thomas Huth
  2017-05-18  8:03   ` David Hildenbrand
  1 sibling, 0 replies; 12+ messages in thread
From: Thomas Huth @ 2017-05-18  2:34 UTC (permalink / raw)
  To: Radim Krčmář, kvm; +Cc: Paolo Bonzini

On 17.05.2017 22:14, Radim Krčmář wrote:
> 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(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [kvm-unit-tests PATCH 2/6] libcflat: add format checking to report()
  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
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Huth @ 2017-05-18  2:38 UTC (permalink / raw)
  To: Radim Krčmář, kvm; +Cc: Paolo Bonzini

On 17.05.2017 22:14, Radim Krčmář wrote:
> report() is a wrapper for printf(), but the compiler was not aware.
> 
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
>  lib/libcflat.h | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/libcflat.h b/lib/libcflat.h
> index b1ea5e607033..a5c42903b11f 100644
> --- a/lib/libcflat.h
> +++ b/lib/libcflat.h
> @@ -96,14 +96,20 @@ extern int vsnprintf(char *buf, int size, const char *fmt, va_list va)
>  extern int vprintf(const char *fmt, va_list va)
>  					__attribute__((format(printf, 1, 0)));
>  
> -void report_prefix_pushf(const char *prefix_fmt, ...);
> +void report_prefix_pushf(const char *prefix_fmt, ...)
> +					__attribute__((format(printf, 1, 2)));
>  extern void report_prefix_push(const char *prefix);
>  extern void report_prefix_pop(void);
> -extern void report(const char *msg_fmt, bool pass, ...);
> -extern void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...);
> -extern void report_abort(const char *msg_fmt, ...);
> -extern void report_skip(const char *msg_fmt, ...);
> -extern void report_info(const char *msg_fmt, ...);
> +extern void report(const char *msg_fmt, bool pass, ...)
> +					__attribute__((format(printf, 1, 3)));
> +extern void report_xfail(const char *msg_fmt, bool xfail, bool pass, ...)
> +					__attribute__((format(printf, 1, 4)));
> +extern void report_abort(const char *msg_fmt, ...)
> +					__attribute__((format(printf, 1, 2)));
> +extern void report_skip(const char *msg_fmt, ...)
> +					__attribute__((format(printf, 1, 2)));
> +extern void report_info(const char *msg_fmt, ...)
> +					__attribute__((format(printf, 1, 2)));
>  extern void report_pass(void);
>  extern int report_summary(void);

Reviewed-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [kvm-unit-tests PATCH 4/6] pci-edu: remove 0x before a decimal value
  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
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Huth @ 2017-05-18  2:39 UTC (permalink / raw)
  To: Radim Krčmář, kvm; +Cc: Paolo Bonzini

On 17.05.2017 22:14, Radim Krčmář wrote:
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
>  lib/pci-edu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/pci-edu.c b/lib/pci-edu.c
> index f94962f0001a..58ce0b56554d 100644
> --- a/lib/pci-edu.c
> +++ b/lib/pci-edu.c
> @@ -48,7 +48,7 @@ void edu_dma(struct pci_edu_dev *dev, iova_t iova,
>  	assert(size <= EDU_DMA_SIZE_MAX);
>  	assert(dev_offset < EDU_DMA_SIZE_MAX);
>  
> -	printf("edu device DMA start %s addr 0x%" PRIx64 " size 0x%lu off 0x%x\n",
> +	printf("edu device DMA start %s addr 0x%" PRIx64 " size %lu off 0x%x\n",
>  	       from_device ? "FROM" : "TO",
>  	       iova, (ulong)size, dev_offset);
>  

Reviewed-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [kvm-unit-tests PATCH 1/6] fix conversions in report()s
  2017-05-17 20:14 ` [kvm-unit-tests PATCH 1/6] fix conversions in report()s Radim Krčmář
  2017-05-18  2:34   ` Thomas Huth
@ 2017-05-18  8:03   ` David Hildenbrand
  1 sibling, 0 replies; 12+ messages in thread
From: David Hildenbrand @ 2017-05-18  8:03 UTC (permalink / raw)
  To: Radim Krčmář, kvm; +Cc: Paolo Bonzini

On 17.05.2017 22:14, Radim Krčmář wrote:
> 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(-)
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [kvm-unit-tests PATCH 0/6] improve report/printf formatting
  2017-05-17 20:13 [kvm-unit-tests PATCH 0/6] improve report/printf formatting Radim Krčmář
                   ` (5 preceding siblings ...)
  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 ` Paolo Bonzini
  6 siblings, 0 replies; 12+ messages in thread
From: Paolo Bonzini @ 2017-05-18 16:04 UTC (permalink / raw)
  To: Radim Krčmář, kvm



On 17/05/2017 22:13, Radim Krčmář wrote:
> This series is a mix of three logical units:
> 
>   [1-2/6]: add format checking to report() and fix revealed bugs
> 
>   [3/6]: fix padding in %p conversions
> 
>   [4-6/6]: fix random 0x%d and support %# to make this mistake harder

Nice!

Paolo

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-05-18 16:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17 20:13 [kvm-unit-tests PATCH 0/6] improve report/printf formatting Radim Krčmář
2017-05-17 20:14 ` [kvm-unit-tests PATCH 1/6] fix conversions in report()s Radim Krčmář
2017-05-18  2:34   ` 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

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.