All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vl: Fix an assert failure in error path
@ 2021-06-10  8:47 Zhenzhong Duan
  2021-06-09  9:30 ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Zhenzhong Duan @ 2021-06-10  8:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Zhenzhong Duan

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

Without fix, the uninitialized *errp triggers assert failure which
doesn't show much valuable information.

Before the fix:
qemu-system-x86_64: ../util/error.c:59: error_setv: Assertion `*errp == NULL' failed.

After fix:
qemu-system-x86_64: cannot create PID file: Cannot open pid file: Permission denied

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
 softmmu/vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 326c1e9080..feb4d201f3 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2522,7 +2522,7 @@ static void qemu_process_help_options(void)
 
 static void qemu_maybe_daemonize(const char *pid_file)
 {
-    Error *err;
+    Error *err = NULL;
 
     os_daemonize();
     rcu_disable_atfork();
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-06-10 13:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-10  8:47 [PATCH] vl: Fix an assert failure in error path Zhenzhong Duan
2021-06-09  9:30 ` Paolo Bonzini
2021-06-09 12:09   ` Markus Armbruster
2021-06-09 12:15     ` Daniel P. Berrangé
2021-06-10  1:47       ` Peng Liang
2021-06-10  7:32         ` Markus Armbruster
2021-06-10 13:29           ` Peng Liang
2021-06-10 12:55     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.