[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] Compile error with Ubuntu 11.10



On Thu, 2011-12-01 at 17:14 +0000, Ian Jackson wrote:
> Ian Campbell writes ("Re: [Xen-devel] Compile error with Ubuntu 11.10"):
> > I expect that this needs to change to be
> >     return libxl__xs_write(gc, XBT_NULL, path, "%s", libxl__strdup(gc,
> >        
> > libxl_device_model_version_to_string(dm_info->device_model_version)));
> > (note the additional "%s",)
> > 
> > Can you try that?
> 
> Here's a patch which I think should fix this.  Adda, can you try it
> please ?
> 
> libxl: Fix format string problem resulting in compile warning
> 
> Fixes:
>   libxl_create.c:465: error: format not a string literal and no format 
>   arguments
> (The warning does not relate to security problem in this case,
> because the string erroneously used as a format came from our enum
> conversion and is safe.)

If distros (or gcc) are starting to enable -Wformat-nonliteral (assuming
that is what this is) by default perhaps we should preemptively set it
ourselves?

Setting it found one other instance of a weird strdup (actually a
sprintf of a string we just sprintf'd). but otherwise it seems to work.

8<-------------------------------

libxl: build with -Wformat-nonliteral

Fix the remaining issue that this shows up.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 20c1c0ff9677 tools/libxl/Makefile
--- a/tools/libxl/Makefile      Thu Dec 01 12:24:06 2011 +0100
+++ b/tools/libxl/Makefile      Thu Dec 01 17:59:25 2011 +0000
@@ -11,7 +11,7 @@ MINOR = 0
 XLUMAJOR = 1.0
 XLUMINOR = 0
 
-CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations
+CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations 
-Wformat-nonliteral
 CFLAGS += -I. -fPIC
 
 ifeq ($(CONFIG_Linux),y)

 static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
diff -r 20c1c0ff9677 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Thu Dec 01 12:24:06 2011 +0100
+++ b/tools/libxl/libxl_device.c        Thu Dec 01 17:59:25 2011 +0000
@@ -516,7 +516,7 @@ int libxl__devices_destroy(libxl__gc *gc
         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, path);
             if (path && libxl__parse_backend_path(gc, path, &dev) == 0) {
                 dev.domid = domid;
                 dev.kind = kind;



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.