Skip to contentSkip to conversation

xl: fix compiler warnings

PATCH In review Andre Przywara 2 participants 2 messages Dec 2, 2011 – Dec 12, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xl: fix compiler warnings

Hi,

either GCC 4.6.1 or Ubuntu add -Werror=format-security to the -Wall set, so libxl compilation breaks:
libxl_create.c: In function 'store_libxl_entry':
libxl_create.c:454:9: error: format not a string literal and no
format arguments [-Werror=format-security]
cc1: all warnings being treated as errors

attached patch fixes this and another occurrence.

Patch from: Uwe Dannowski

Regards,
Andre.

Signature · 2 lines
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
tools/libxl/libxl_create.c +1 -1
index ce6a55e..6486156 100644
@@ -461,7 +461,7 @@ static int store_libxl_entry(libxl__gc *gc, uint32_t domid,
 
     path = libxl__xs_libxl_path(gc, domid);
     path = libxl__sprintf(gc, "%s/dm-version", path);
-    return libxl__xs_write(gc, XBT_NULL, path, libxl__strdup(gc,
+    return libxl__xs_write(gc, XBT_NULL, path, "%s", libxl__strdup(gc,
         libxl_device_model_version_to_string(dm_info->device_model_version)));
 }
 
tools/libxl/libxl_device.c +1 -1
index a53fb70..1db395c 100644
@@ -516,7 +516,7 @@ int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force)
         for (j = 0; j < num_devs; j++) {
             path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s/backend",
                                   domid, kinds[i], devs[j]);
-            path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, path));
+            path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s", path));
             if (path && libxl__parse_backend_path(gc, path, &dev) == 0) {
                 dev.domid = domid;
                 dev.kind = kind;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Acked-by on v1 1/1
#1 lore raw

Andre Przywara writes ("[Xen-devel] [PATCH] xl: fix compiler warnings"):

Quoted 8 lines

either GCC 4.6.1 or Ubuntu add -Werror=format-security to the -Wall set, so libxl compilation breaks:
libxl_create.c: In function 'store_libxl_entry':
libxl_create.c:454:9: error: format not a string literal and no
format arguments [-Werror=format-security]
cc1: all warnings being treated as errors

attached patch fixes this and another occurrence.