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 <c...@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


Reply via email to