Skip to contentSkip to conversation

Compiler warning in grub_cmdline_get

PATCH In review Colin Watson 2 participants 3 messages Aug 26, 2009 – Aug 28, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Compiler warning in grub_cmdline_get

I don't think this can actually cause a real problem, but it's a compiler warning since it might (e.g. if prompt ever contained "%").

/home/cjwatson/src/ubuntu/grub2/tmp/grub2-1.96+20090826/normal/cmdline.c: In function ‘grub_cmdline_get’:
/home/cjwatson/src/ubuntu/grub2/tmp/grub2-1.96+20090826/normal/cmdline.c:276: warning: format not a string literal and no format arguments

2009-08-27 Colin Watson <[email protected]>

* normal/cmdline.c (grub_cmdline_get): Supply a format string as the first argument to grub_printf.

cmdline.c +1 -1
Index: normal/cmdline.c
===================================================================
@@ -273,7 +273,7 @@
   if ((grub_getxy () >> 8) != 0)
     grub_putchar ('\n');
 
-  grub_printf (prompt);
+  grub_printf ("%s", prompt);
 
   xpos = plen;
   ystart = ypos = (grub_getxy () & 0xFF);
Signature · 1 line
Colin Watson                                       [[email protected]]
#1 lore raw
Quoted 10 lines · Colin Watson

I don't think this can actually cause a real problem, but it's a compiler warning since it might (e.g. if prompt ever contained "%").

/home/cjwatson/src/ubuntu/grub2/tmp/grub2-1.96+20090826/normal/cmdline.c: In function ‘grub_cmdline_get’:
/home/cjwatson/src/ubuntu/grub2/tmp/grub2-1.96+20090826/normal/cmdline.c:276: warning: format not a string literal and no format arguments

2009-08-27 Colin Watson <[email protected]>

* normal/cmdline.c (grub_cmdline_get): Supply a format string as the first argument to grub_printf.

Thanks Colin. For obvious fixes like this one, feel free to commit them right away.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#2 lore raw
Quoted 8 lines · Robert Millan
Quoted 4 lines · Colin Watson

2009-08-27 Colin Watson <[email protected]>

* normal/cmdline.c (grub_cmdline_get): Supply a format string as the first argument to grub_printf.

Thanks Colin. For obvious fixes like this one, feel free to commit them right away.

OK, done.

Signature · 1 line
Colin Watson                                       [[email protected]]