]> xenbits.xensource.com Git - xen.git/commitdiff
tools/libxc: Annotate xc_report_error with __attribute__((format))
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 9 Jun 2014 15:41:06 +0000 (16:41 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 10 Jun 2014 12:46:45 +0000 (13:46 +0100)
This helps the compiler spot printf formatting errors.

Fix up all errors discovered.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Ian Campbell <Ian.Campbell@citrix.com>
CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxc/xc_core.c
tools/libxc/xc_domain_restore.c
tools/libxc/xc_gnttab.c
tools/libxc/xc_private.h
tools/xenpaging/xenpaging.c

index 4bc1abb4415fc0c8b839755340f97102f374f442..dfa424b732a3e7517b45a55b6aab2707d2d00f09 100644 (file)
@@ -497,7 +497,7 @@ xc_domain_dumpcore_via_callback(xc_interface *xch,
     ctxt = calloc(sizeof(*ctxt), info.max_vcpu_id + 1);
     if ( !ctxt )
     {
-        PERROR("Could not allocate vcpu context array", domid);
+        PERROR("Could not allocate vcpu context array");
         goto out;
     }
 
index 89af1ad1d216b56d3fa08005c2cbcde94a3444ac..b80f867917bfe91bf42b6f9b50951de68177e26f 100644 (file)
@@ -102,7 +102,7 @@ static ssize_t rdexact(xc_interface *xch, struct restore_ctx *ctx,
             errno = 0;
         }
         if ( len <= 0 ) {
-            ERROR("%s failed (read rc: %d, errno: %d)", __func__, len, errno);
+            ERROR("%s failed (read rc: %zd, errno: %d)", __func__, len, errno);
             return -1;
         }
         offset += len;
@@ -443,7 +443,7 @@ static int compat_buffer_qemu(xc_interface *xch, struct restore_ctx *ctx,
     }
 
     if ( memcmp(qbuf, "QEVM", 4) ) {
-        ERROR("Invalid QEMU magic: 0x%08x", *(unsigned long*)qbuf);
+        ERROR("Invalid QEMU magic: 0x%08"PRIx32, *(uint32_t*)qbuf);
         free(qbuf);
         return -1;
     }
@@ -1802,7 +1802,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
     } else if (pagebuf.acpi_ioport_location == 0) {
         DBGPRINTF("Use old firmware ioport from the checkpoint\n");
     } else {
-        ERROR("Error, unknow acpi ioport location (%i)", pagebuf.acpi_ioport_location);
+        ERROR("Error, unknow acpi ioport location (%"PRId64")", pagebuf.acpi_ioport_location);
     }
 
     tdatatmp = tdata;
index 3b6058c5cac1f764facce91d1ddd30d6ff7c7beb..4076e478e3d8a9dd41ba0d5919e04279cb86ff5c 100644 (file)
@@ -75,7 +75,7 @@ static void *_gnttab_map_table(xc_interface *xch, int domid, int *gnt_num)
 
     if ( rc || (query.status != GNTST_okay) )
     {
-        ERROR("Could not query dom's grant size\n", domid);
+        ERROR("Could not query dom%d's grant size\n", domid);
         return NULL;
     }
 
index 670a82d3cfbb0c42e926fdc7cebf00841952de67..29e926c4ec33837dd21d50f89b2721353f246bef 100644 (file)
@@ -93,7 +93,8 @@ struct xc_interface_core {
     xc_osdep_handle  ops_handle; /* opaque data for xc_osdep_ops */
 };
 
-void xc_report_error(xc_interface *xch, int code, const char *fmt, ...);
+void xc_report_error(xc_interface *xch, int code, const char *fmt, ...)
+    __attribute__((format(printf,3,4)));
 void xc_reportv(xc_interface *xch, xentoollog_logger *lg, xentoollog_level,
                 int code, const char *fmt, va_list args)
      __attribute__((format(printf,5,0)));
index 5ef2f091600058d1d8f95fec3ea65b224c2c9280..82c1ee458f928be2be2dda0ecd7b80b859d87e35 100644 (file)
@@ -912,7 +912,7 @@ int main(int argc, char *argv[])
 
             if ( req.gfn > paging->max_pages )
             {
-                ERROR("Requested gfn %"PRIx64" higher than max_pages %lx\n", req.gfn, paging->max_pages);
+                ERROR("Requested gfn %"PRIx64" higher than max_pages %x\n", req.gfn, paging->max_pages);
                 goto out;
             }