Building grub2 with gcc 4.7 snapshot, I see:
commands/usbtest.c: In function 'usb_print_str':
commands/usbtest.c:126:19: error: 'name' may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1: all warnings being treated as errors

line 121 is:
121:   err = grub_usb_get_string (dev, idx, 0x0409, &name);

gcc does not seem to understand that name is only set if grub_usb_get_string returns without an error.

Here's the obvious patch to fix this,
Andreas

Index: grub-1.99/grub-core/commands/usbtest.c
===================================================================
--- grub-1.99.orig/grub-core/commands/usbtest.c
+++ grub-1.99/grub-core/commands/usbtest.c
@@ -111,7 +111,7 @@ grub_usb_get_string (grub_usb_device_t d
 static void
 usb_print_str (const char *description, grub_usb_device_t dev, int idx)
 {
-  char *name;
+  char *name = NULL;
   grub_usb_err_t err;
   /* XXX: LANGID  */

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to