qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>
Subject: [PULL 09/13] qom: Fix default values in help
Date: Thu,  1 Apr 2021 15:12:16 +0200	[thread overview]
Message-ID: <20210401131220.3252320-10-thuth@redhat.com> (raw)
In-Reply-To: <20210401131220.3252320-1-thuth@redhat.com>

From: Markus Armbruster <armbru@redhat.com>

Output of default values in device help is broken:

    $ ./qemu-system-x86_64 -S -display none -monitor stdio
    QEMU 5.2.50 monitor - type 'help' for more information
    (qemu) device_add pvpanic,help
    pvpanic options:
      events=<uint8>         -  (default: (null))
      ioport=<uint16>        -  (default: (null))
      pvpanic[0]=<child<qemu:memory-region>>

The "(null)" is glibc printing a null pointer.  Other systems crash
instead.  Having a help request crash a running VM can really spoil
your day.

Root cause is a botched replacement of qstring_free() by
g_string_free(): to get the string back, we need to pass true to the
former, but false to the latter.  Fix the argument.

Fixes: eab3a4678b07267c39e7290a6e9e7690b1d2a521
Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210324084130.3986072-1-armbru@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 qom/object_interfaces.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index c3324b0f86..bd8a947a63 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -159,7 +159,7 @@ char *object_property_help(const char *name, const char *type,
     }
     if (defval) {
         g_autofree char *def_json = g_string_free(qobject_to_json(defval),
-                                                  true);
+                                                  false);
         g_string_append_printf(str, " (default: %s)", def_json);
     }
 
-- 
2.27.0



  parent reply	other threads:[~2021-04-01 13:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01 13:12 [PULL 00/13] Updates to MAINTAINERS, docs, and some small fixes Thomas Huth
2021-04-01 13:12 ` [PULL 01/13] MAINTAINERS: Fix tests/migration maintainers Thomas Huth
2021-04-01 13:12 ` [PULL 02/13] MAINTAINERS: add/replace backups for some s390 areas Thomas Huth
2021-04-01 13:12 ` [PULL 03/13] MAINTAINERS: Drop the lines with Sarah Harris Thomas Huth
2021-04-01 13:12 ` [PULL 04/13] MAINTAINERS: replace Huawei's email to personal one Thomas Huth
2021-04-01 13:12 ` [PULL 05/13] MAINTAINERS: Drop the line with Xiang Zheng Thomas Huth
2021-04-01 13:12 ` [PULL 06/13] MAINTAINERS: add virtio-fs mailing list Thomas Huth
2021-04-01 13:12 ` [PULL 07/13] MAINTAINERS: Mark RX hardware emulation orphan Thomas Huth
2021-04-01 13:12 ` [PULL 08/13] MAINTAINERS: Mark SH-4 " Thomas Huth
2021-04-01 13:12 ` Thomas Huth [this message]
2021-04-01 13:12 ` [PULL 10/13] util/compatfd.c: Fixed style issues Thomas Huth
2021-04-01 13:12 ` [PULL 11/13] docs: Remove obsolete paragraph about config-target.mak Thomas Huth
2021-04-01 13:12 ` [PULL 12/13] docs: Fix typo in the default name of the qemu-system-x86_64 binary Thomas Huth
2021-04-01 13:12 ` [PULL 13/13] device-crash-test: Ignore errors about a bus not being available Thomas Huth
2021-04-02 10:52 ` [PULL 00/13] Updates to MAINTAINERS, docs, and some small fixes Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210401131220.3252320-10-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=armbru@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).