From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>, qemu-devel@nongnu.org
Cc: "Damien Hedde" <damien.hedde@greensocs.com>,
"Kevin Wolf" <kwolf@redhat.com>,
"Daniel P . Berrangé" <berrange@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [PATCH v2] util/qemu-option: Document the get_opt_value() function
Date: Mon, 6 Jul 2020 18:14:33 -0700 [thread overview]
Message-ID: <1dec6cd5-42f8-8e9f-cc87-108e46a926cc@linaro.org> (raw)
In-Reply-To: <20200629070858.19850-1-philmd@redhat.com>
On 6/29/20 12:08 AM, Philippe Mathieu-Daudé wrote:
> Coverity noticed commit 950c4e6c94 introduced a dereference before
> null check in get_opt_value (CID1391003):
>
> In get_opt_value: All paths that lead to this null pointer
> comparison already dereference the pointer earlier (CWE-476)
>
> We fixed this in commit 6e3ad3f0e31, but relaxed the check in commit
> 0c2f6e7ee99 because "No callers of get_opt_value() pass in a NULL
> for the 'value' parameter".
>
> Since this function is publicly exposed, it risks new users to do
> the same error again. Avoid that documenting the 'value' argument
> must not be NULL.
I think we should also add some use of __attribute__((nonnull(...))) to enforce
this within the compiler.
I recently did this without a qemu/compiler.h QEMU_FOO wrapper within
target/arm. But the nonnull option has optional arguments, so it might be
difficult to wrap in macros.
r~
next prev parent reply other threads:[~2020-07-07 1:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 7:08 [PATCH v2] util/qemu-option: Document the get_opt_value() function Philippe Mathieu-Daudé
2020-06-29 9:03 ` Daniel P. Berrangé
2020-07-04 16:46 ` Philippe Mathieu-Daudé
2020-07-06 16:58 ` Laurent Vivier
2020-07-07 1:14 ` Richard Henderson [this message]
2020-07-07 2:14 ` Philippe Mathieu-Daudé
2020-07-07 8:38 ` Daniel P. Berrangé
2020-07-07 5:35 ` Markus Armbruster
2020-07-07 5:48 ` Thomas Huth
2020-07-07 12:04 ` Markus Armbruster
2020-07-07 5:48 ` Markus Armbruster
2020-07-07 6:11 ` Philippe Mathieu-Daudé
2020-07-07 12:03 ` Markus Armbruster
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=1dec6cd5-42f8-8e9f-cc87-108e46a926cc@linaro.org \
--to=richard.henderson@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=damien.hedde@greensocs.com \
--cc=kwolf@redhat.com \
--cc=philmd@redhat.com \
--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).