[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] ipmi: don't try to open a NULL filename
From: |
Cédric Le Goater |
Subject: |
[Qemu-devel] [PATCH 2/2] ipmi: don't try to open a NULL filename |
Date: |
Tue, 25 Apr 2017 08:51:41 +0200 |
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 <address@hidden>
---
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