From: David Gibson <david@gibson.dropbear.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: Corey Minyard <cminyard@mvista.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] ipmi: don't try to open a NULL filename
Date: Wed, 26 Apr 2017 12:42:44 +1000 [thread overview]
Message-ID: <20170426024244.GK16882@umbus.fritz.box> (raw)
In-Reply-To: <1493103101-25165-3-git-send-email-clg@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 1541 bytes --]
On Tue, Apr 25, 2017 at 08:51:41AM +0200, Cédric Le Goater wrote:
> Currenlty, the code relies on the fact that open() handles NULL
> filenames but that can cause an error with new clang:
>
> hw/core/loader.c:67:15: runtime error: null pointer passed as argument 1,
> which is declared to never be null
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Since my ppc-for-2.10 pull request has been held up because of this
anyway, tather than just apply this on top, I've folded it into your
earlier patch which caused the bug - that way we won't break bisect.
> ---
> hw/ipmi/ipmi_bmc_sim.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
> index 155561d06614..277c28cb40ed 100644
> --- a/hw/ipmi/ipmi_bmc_sim.c
> +++ b/hw/ipmi/ipmi_bmc_sim.c
> @@ -1899,6 +1899,10 @@ static void ipmi_fru_init(IPMIFru *fru)
> int fsize;
> int size = 0;
>
> + if (!fru->filename) {
> + goto out;
> + }
> +
> fsize = get_image_size(fru->filename);
> if (fsize > 0) {
> size = QEMU_ALIGN_UP(fsize, fru->areasize);
> @@ -1910,6 +1914,7 @@ static void ipmi_fru_init(IPMIFru *fru)
> }
> }
>
> +out:
> if (!fru->data) {
> /* give one default FRU */
> size = fru->areasize;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2017-04-26 3:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-25 6:51 [Qemu-devel] [PATCH 0/2] ipmi: fix open() NULL argument Cédric Le Goater
2017-04-25 6:51 ` [Qemu-devel] [PATCH 1/2] tests: add IPMI tests for ppc64 Cédric Le Goater
2017-04-25 6:51 ` [Qemu-devel] [PATCH 2/2] ipmi: don't try to open a NULL filename Cédric Le Goater
2017-04-25 13:18 ` Eric Blake
2017-04-25 13:31 ` Peter Maydell
2017-04-25 14:06 ` Cédric Le Goater
2017-04-26 2:43 ` David Gibson
2017-04-26 6:41 ` Cédric Le Goater
2017-04-26 2:42 ` David Gibson [this message]
2017-04-26 6:05 ` Cédric Le Goater
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=20170426024244.GK16882@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=clg@kaod.org \
--cc=cminyard@mvista.com \
--cc=mst@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).