Skip to contentSkip to conversation

hw/mips/boston: Initialize g_autofree pointers

PATCH Applied Bernhard Beschow 3 participants 6 messages Jun 5, 2022 – Jun 11, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/mips/boston: Initialize g_autofree pointers

Fixes compilation due to false positives with -Werror:

In file included from /usr/include/glib-2.0/glib.h:114,

                   from qemu/src/include/glib-compat.h:32,
                   from qemu/src/include/qemu/osdep.h:144,
                   from ../src/hw/mips/boston.c:20:
  In function ‘g_autoptr_cleanup_generic_gfree’,
      inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:52:
  /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_load_data’ may be used uninitialized [-Werror=maybe-uninitialized]
     28 |   g_free (*pp);
        |   ^~~~~~~~~~~~
  ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
  ../src/hw/mips/boston.c:790:52: note: ‘dtb_load_data’ was declared here
    790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
        |                                                    ^~~~~~~~~~~~~
  In function ‘g_autoptr_cleanup_generic_gfree’,
    inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:36:
  /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_file_data’ may be used uninitialized [-Werror=maybe-uninitialized]
     28 |   g_free (*pp);
        |   ^~~~~~~~~~~~
  ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
  ../src/hw/mips/boston.c:790:36: note: ‘dtb_file_data’ was declared here
    790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
        |                                    ^~~~~~~~~~~~~

cc1: all warnings being treated as errors

---
 hw/mips/boston.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/mips/boston.c +2 -1
index 59ca08b93a..1debca18ec 100644
@@ -787,7 +787,8 @@ static void boston_mach_init(MachineState *machine)
 
         if (kernel_size > 0) {
             int dt_size;
-            g_autofree const void *dtb_file_data, *dtb_load_data;
+            g_autofree const void *dtb_file_data = NULL;
+            g_autofree const void *dtb_load_data = NULL;
             hwaddr dtb_paddr = QEMU_ALIGN_UP(kernel_high, 64 * KiB);
             hwaddr dtb_vaddr = cpu_mips_phys_to_kseg0(NULL, dtb_paddr);
 
Signature · 1 line
2.36.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 24 lines · Bernhard Beschow

Fixes compilation due to false positives with -Werror:

In file included from /usr/include/glib-2.0/glib.h:114,

                    from qemu/src/include/glib-compat.h:32,
                    from qemu/src/include/qemu/osdep.h:144,
                    from ../src/hw/mips/boston.c:20:
   In function ‘g_autoptr_cleanup_generic_gfree’,
       inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:52:
   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_load_data’ may be used uninitialized [-Werror=maybe-uninitialized]
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:52: note: ‘dtb_load_data’ was declared here
     790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
         |                                                    ^~~~~~~~~~~~~
   In function ‘g_autoptr_cleanup_generic_gfree’,
     inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:36:
   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_file_data’ may be used uninitialized [-Werror=maybe-uninitialized]
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:36: note: ‘dtb_file_data’ was declared here
     790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
         |                                    ^~~~~~~~~~~~~
Quoted 6 lines

cc1: all warnings being treated as errors

---
  hw/mips/boston.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

r~

Reviewed-by Philippe Mathieu-Daudé on v1 1/1 Applied
#2 lore raw
In reply to Bernhard Beschow
Quoted 36 lines · Bernhard Beschow

Fixes compilation due to false positives with -Werror:

In file included from /usr/include/glib-2.0/glib.h:114,

                    from qemu/src/include/glib-compat.h:32,
                    from qemu/src/include/qemu/osdep.h:144,
                    from ../src/hw/mips/boston.c:20:
   In function ‘g_autoptr_cleanup_generic_gfree’,
       inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:52:
   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_load_data’ may be used uninitialized [-Werror=maybe-uninitialized]
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:52: note: ‘dtb_load_data’ was declared here
     790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
         |                                                    ^~~~~~~~~~~~~
   In function ‘g_autoptr_cleanup_generic_gfree’,
     inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:36:
   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_file_data’ may be used uninitialized [-Werror=maybe-uninitialized]
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:36: note: ‘dtb_file_data’ was declared here
     790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
         |                                    ^~~~~~~~~~~~~

cc1: all warnings being treated as errors

---
  hw/mips/boston.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
hw/mips/boston.c +0 -0
index 59ca08b93a..1debca18ec 100644

hw/mips/boston.c static void boston_mach_init(MachineState *machine) · line 794

Quoted 9 lines
hw/mips/boston.c +2 -1
@@ -787,7 +787,8 @@ static void boston_mach_init(MachineState *machine)
 
          if (kernel_size > 0) {
              int dt_size;
-            g_autofree const void *dtb_file_data, *dtb_load_data;
+            g_autofree const void *dtb_file_data = NULL;
+            g_autofree const void *dtb_load_data = NULL;
              hwaddr dtb_paddr = QEMU_ALIGN_UP(kernel_high, 64 * KiB);
              hwaddr dtb_vaddr = cpu_mips_phys_to_kseg0(NULL, dtb_paddr);
 

Queued to mips-next.

#3 lore raw
In reply to Bernhard Beschow
Quoted 24 lines · Bernhard Beschow

Fixes compilation due to false positives with -Werror:

In file included from /usr/include/glib-2.0/glib.h:114,

                    from qemu/src/include/glib-compat.h:32,
                    from qemu/src/include/qemu/osdep.h:144,
                    from ../src/hw/mips/boston.c:20:
   In function ‘g_autoptr_cleanup_generic_gfree’,
       inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:52:
   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_load_data’ may be used uninitialized [-Werror=maybe-uninitialized]
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:52: note: ‘dtb_load_data’ was declared here
     790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
         |                                                    ^~~~~~~~~~~~~
   In function ‘g_autoptr_cleanup_generic_gfree’,
     inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:36:
   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_file_data’ may be used uninitialized [-Werror=maybe-uninitialized]
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:36: note: ‘dtb_file_data’ was declared here
     790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
         |                                    ^~~~~~~~~~~~~
Quoted 6 lines

cc1: all warnings being treated as errors

---
  hw/mips/boston.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Queued via mips-next.

#4 lore raw
Quoted 34 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Bernhard Beschow

Fixes compilation due to false positives with -Werror:

   In file included from /usr/include/glib-2.0/glib.h:114,
                    from qemu/src/include/glib-compat.h:32,
                    from qemu/src/include/qemu/osdep.h:144,
                    from ../src/hw/mips/boston.c:20:
   In function ‘g_autoptr_cleanup_generic_gfree’,
       inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:52:
   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error:

‘dtb_load_data’ may be used uninitialized [-Werror=maybe-uninitialized]

Quoted 4 lines
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:52: note: ‘dtb_load_data’ was declared

here

Quoted 1 line

790 | g_autofree const void *dtb_file_data,

*dtb_load_data;

Quoted 1 line
         |

^~~~~~~~~~~~~

Quoted 3 lines

In function ‘g_autoptr_cleanup_generic_gfree’,
inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:36:

   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error:

‘dtb_file_data’ may be used uninitialized [-Werror=maybe-uninitialized]

Quoted 4 lines
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:36: note: ‘dtb_file_data’ was declared

here

Quoted 1 line

790 | g_autofree const void *dtb_file_data,

*dtb_load_data;

Quoted 3 lines
         |                                    ^~~~~~~~~~~~~

cc1: all warnings being treated as errors

Quoted 7 lines
Quoted 4 lines
---
  hw/mips/boston.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Queued via mips-next.

Hi Phil,

shouldn't this patch be visible in your pull request then?
https://patchew.org/QEMU/[email protected]/

Best regards,
Bernhard

#5 lore raw
Quoted 33 lines · Bernhard Beschow
Quoted 32 lines · Philippe Mathieu-Daudé
Quoted 30 lines · Bernhard Beschow

Fixes compilation due to false positives with -Werror:

In file included from /usr/include/glib-2.0/glib.h:114,

                    from qemu/src/include/glib-compat.h:32,
                    from qemu/src/include/qemu/osdep.h:144,
                    from ../src/hw/mips/boston.c:20:
   In function ‘g_autoptr_cleanup_generic_gfree’,
       inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:52:
   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_load_data’ may be used uninitialized [-Werror=maybe-uninitialized]
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:52: note: ‘dtb_load_data’ was declared here
     790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
         |                                                    ^~~~~~~~~~~~~
   In function ‘g_autoptr_cleanup_generic_gfree’,
     inlined from ‘boston_mach_init’ at ../src/hw/mips/boston.c:790:36:
   /usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘dtb_file_data’ may be used uninitialized [-Werror=maybe-uninitialized]
      28 |   g_free (*pp);
         |   ^~~~~~~~~~~~
   ../src/hw/mips/boston.c: In function ‘boston_mach_init’:
   ../src/hw/mips/boston.c:790:36: note: ‘dtb_file_data’ was declared here
     790 |             g_autofree const void *dtb_file_data, *dtb_load_data;
         |                                    ^~~~~~~~~~~~~

cc1: all warnings being treated as errors

---
  hw/mips/boston.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 6 lines
Quoted 1 line

Queued via mips-next.

Hi Phil,

shouldn't this patch be visible in your pull request then? https://patchew.org/QEMU/[email protected]/

It was included, but I have been overzealous when removing Mark's PS2 series and removed it as well :/

Quoted 2 lines

Best regards,
Bernhard