From: Peter Maydell <peter.maydell@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-stable <qemu-stable@nongnu.org>,
QEMU Developers <qemu-devel@nongnu.org>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [PULL 12/13] vl: plumb keyval-based options into -readconfig
Date: Tue, 29 Jun 2021 13:52:04 +0100 [thread overview]
Message-ID: <CAFEAcA-TVNe-seP3MMmNtX4zYGiZ06zOKapPA9rdR4DN8e3Uqw@mail.gmail.com> (raw)
In-Reply-To: <20210604151745.310318-13-pbonzini@redhat.com>
On Fri, 4 Jun 2021 at 16:23, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Let -readconfig support parsing command line options into QDict or
> QemuOpts. This will be used to add back support for objects in
> -readconfig.
>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: qemu-stable@nongnu.org
> Reviewed-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Message-Id: <20210524105752.3318299-3-pbonzini@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Hi; Coverity suspects a resource leak in this code (CID 1457455):
> +/*
> + * Parse non-QemuOpts config file groups, pass the rest to
> + * qemu_config_do_parse.
> + */
> +static void qemu_parse_config_group(const char *group, QDict *qdict,
> + void *opaque, Error **errp)
> +{
> + QObject *crumpled;
> + if (is_qemuopts_group(group)) {
> + qemu_config_do_parse(group, qdict, opaque, errp);
> + return;
> + }
> +
> + crumpled = qdict_crumple(qdict, errp);
It thinks qdict_crumple() allocates memory...
> + if (!crumpled) {
> + return;
> + }
> + if (qobject_type(crumpled) != QTYPE_QDICT) {
> + assert(qobject_type(crumpled) == QTYPE_QLIST);
> + error_setg(errp, "Lists cannot be at top level of a configuration section");
...but here we return without freeing/derefing it or keeping track
of the pointer anywhere...
> + return;
> + }
> + qemu_record_config_group(group, qobject_to(QDict, crumpled), false, errp);
...and here it thinks that qemu_record_config_group does not free or
keep a pointer to 'crumpled', though in this case I suspect it is wrong.
More general question: where should I look to find documentation on
what functions take 'ownership' of a reference-counted object?
I often find when trying to analyse Coverity reports like these that
I am just as confused as it is about whether a function really has
taken ownership of something or whether the caller kept ownership
and needed to deref it...
thanks
-- PMM
next prev parent reply other threads:[~2021-06-29 12:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-04 15:17 [PULL 00/13] Misc bugfix patches for 2021-06-04 Paolo Bonzini
2021-06-04 15:17 ` [PULL 01/13] meson: allow optional dependencies for block modules Paolo Bonzini
2021-06-04 15:17 ` [PULL 02/13] iscsi: link libm into the module Paolo Bonzini
2021-06-04 15:17 ` [PULL 03/13] oslib-posix: Remove OpenBSD workaround for fcntl("/dev/null", F_SETFL, O_NONBLOCK) failure Paolo Bonzini
2021-06-04 15:17 ` [PULL 04/13] target/i386: tcg: fix segment register offsets for 16-bit TSS Paolo Bonzini
2021-06-04 15:17 ` [PULL 05/13] target/i386: tcg: fix loading of registers from " Paolo Bonzini
2021-06-04 15:17 ` [PULL 06/13] target/i386: tcg: fix switching from 16-bit to 32-bit tasks or vice versa Paolo Bonzini
2021-06-04 15:17 ` [PULL 07/13] target/i386: Fix decode of cr8 Paolo Bonzini
2021-06-04 15:17 ` [PULL 08/13] tests/qtest/virtio-scsi-test: add unmap large LBA with 4k blocks test Paolo Bonzini
2021-06-04 15:17 ` [PULL 09/13] i386: reorder call to cpu_exec_realizefn Paolo Bonzini
2021-06-04 15:17 ` [PULL 10/13] i386: run accel_cpu_instance_init as post_init Paolo Bonzini
2021-06-04 15:17 ` [PULL 11/13] qemu-config: parse configuration files to a QDict Paolo Bonzini
2021-06-04 15:17 ` [PULL 12/13] vl: plumb keyval-based options into -readconfig Paolo Bonzini
2021-06-29 12:52 ` Peter Maydell [this message]
2021-06-04 15:17 ` [PULL 13/13] vl: plug -object back " Paolo Bonzini
2021-06-05 10:25 ` [PULL 00/13] Misc bugfix patches for 2021-06-04 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=CAFEAcA-TVNe-seP3MMmNtX4zYGiZ06zOKapPA9rdR4DN8e3Uqw@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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).