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 <c...@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: signature.asc
Description: PGP signature

Reply via email to