Skip to contentSkip to conversation

runstate: Initialize Error * to NULL

PATCH Applied Peng Liang 3 participants 3 messages Jun 10, 2021

lore
Share & tools
lore

Peng Liang

author
#0 lore raw

PATCH 1/1 runstate: Initialize Error * to NULL

Based on the description of error_setg(), the local variable err in qemu_init_subsystems() should be initialized to NULL.

Fix: efd7ab22fb "vl: extract qemu_init_subsystems"

---
The patch is generated by the following coccinelle script (thanks to Markus):
@ r @
identifier id;
@@
(
static Error *id;
|
Error *id
+ = NULL
;
)
And exclude the modifications in softmmu/vl.c (which has fixed by Zhenzhong Duan already) and util/error.c (which are unnecessary).

 softmmu/runstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
softmmu/runstate.c +1 -1
index ce8977c6a29c..54713100c2ea 100644
@@ -746,7 +746,7 @@ static void qemu_run_exit_notifiers(void)
 
 void qemu_init_subsystems(void)
 {
-    Error *err;
+    Error *err = NULL;
 
     os_set_line_buffering();
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 21 lines · Peng Liang

Based on the description of error_setg(), the local variable err in qemu_init_subsystems() should be initialized to NULL.

Fix: efd7ab22fb "vl: extract qemu_init_subsystems"

---
The patch is generated by the following coccinelle script (thanks to Markus):
@ r @
identifier id;
@@
(
static Error *id;
|
Error *id
+ = NULL
;
)
And exclude the modifications in softmmu/vl.c (which has fixed by Zhenzhong Duan already) and util/error.c (which are unnecessary).

Quoted 2 lines
 softmmu/runstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#2 lore raw
In reply to Peng Liang
Quoted 30 lines · Peng Liang

Based on the description of error_setg(), the local variable err in qemu_init_subsystems() should be initialized to NULL.

Fix: efd7ab22fb "vl: extract qemu_init_subsystems"

---
The patch is generated by the following coccinelle script (thanks to Markus):
@ r @
identifier id;
@@
(
static Error *id;
|
Error *id
+ = NULL
;
)
And exclude the modifications in softmmu/vl.c (which has fixed by Zhenzhong Duan already) and util/error.c (which are unnecessary).

  softmmu/runstate.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
softmmu/runstate.c +0 -0
index ce8977c6a29c..54713100c2ea 100644

softmmu/runstate.c static void qemu_run_exit_notifiers(void) · line 752

Quoted 8 lines
softmmu/runstate.c +1 -1
@@ -746,7 +746,7 @@ static void qemu_run_exit_notifiers(void)
 
  void qemu_init_subsystems(void)
  {
-    Error *err;
+    Error *err = NULL;
 
      os_set_line_buffering();
 

Queued, thanks.

Paolo