libxl: Fix the bug introduced in commit "libxl: use correct type modifier for vuart_gfn"
authorBhupinder Thakur <bhupinder.thakur@linaro.org>
Tue, 31 Oct 2017 06:55:05 +0000 (12:25 +0530)
committerWei Liu <wei.liu2@citrix.com>
Tue, 14 Nov 2017 13:56:27 +0000 (13:56 +0000)
In libxl__device_vuart_add vuart_gfn is getting stored as a hex value:

> flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn));

However, xenstore reads this value as a decimal value and tries to map the
wrong address and fails.

This patch introduces a new format specifier "PRIu_xen_pfn" which formats the value as a
decimal value.

Signed-off-by: Bhupinder Thakur <bhupinder.thakur@linaro.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
tools/libxl/libxl_console.c
xen/include/public/arch-arm.h
xen/include/public/arch-x86/xen.h

index c05dc28b99f3a00822cfbc5a848feccd181ad9de..6bfc0e55c60b84fdf67906940fe1978f1c5fe2eb 100644 (file)
@@ -376,7 +376,7 @@ int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid,
     flexarray_append(ro_front, "port");
     flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port));
     flexarray_append(ro_front, "ring-ref");
-    flexarray_append(ro_front, GCSPRINTF("%"PRI_xen_pfn, state->vuart_gfn));
+    flexarray_append(ro_front, GCSPRINTF("%"PRIu_xen_pfn, state->vuart_gfn));
     flexarray_append(ro_front, "limit");
     flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT));
     flexarray_append(ro_front, "type");
index 5708cd261de7e7bf11592c7868383c22ee97eb39..05fd11ca38d3f2774e4f213b30e82c85cfe18d1f 100644 (file)
@@ -274,6 +274,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_core_regs_t);
 
 typedef uint64_t xen_pfn_t;
 #define PRI_xen_pfn PRIx64
+#define PRIu_xen_pfn PRIu64
 
 /* Maximum number of virtual CPUs in legacy multi-processor guests. */
 /* Only one. All other VCPUS must use VCPUOP_register_vcpu_info */
index ff918310f688942dec43fcb691377ae0b3fd792f..3b0b1d607302a5191aaf511fb2e216d88422bdbb 100644 (file)
@@ -75,6 +75,7 @@ __DeFiNe__ __DECL_REG_LO16(name) e ## name
 #ifndef __ASSEMBLY__
 typedef unsigned long xen_pfn_t;
 #define PRI_xen_pfn "lx"
+#define PRIu_xen_pfn "lu"
 #endif
 
 #define XEN_HAVE_PV_GUEST_ENTRY 1