From: "Cédric Le Goater" <clg@kaod.org>
To: Corey Minyard <cminyard@mvista.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, "Cédric Le Goater" <clg@kaod.org>
Subject: [Qemu-devel] [PATCH 2/2] ipmi: don't try to open a NULL filename
Date: Tue, 25 Apr 2017 08:51:41 +0200 [thread overview]
Message-ID: <1493103101-25165-3-git-send-email-clg@kaod.org> (raw)
In-Reply-To: <1493103101-25165-1-git-send-email-clg@kaod.org>
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>
---
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;
--
2.7.4
next prev parent reply other threads:[~2017-04-25 6:52 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 ` Cédric Le Goater [this message]
2017-04-25 13:18 ` [Qemu-devel] [PATCH 2/2] ipmi: don't try to open a NULL filename 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
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=1493103101-25165-3-git-send-email-clg@kaod.org \
--to=clg@kaod.org \
--cc=cminyard@mvista.com \
--cc=david@gibson.dropbear.id.au \
--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).