qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 02/25] hw/core/loader-fit: fix freeing errp in fit_load_fd


From: Eric Blake
Subject: Re: [PATCH v3 02/25] hw/core/loader-fit: fix freeing errp in fit_load_fdt
Date: Tue, 24 Sep 2019 15:38:59 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 9/24/19 3:08 PM, Vladimir Sementsov-Ogievskiy wrote:
> fit_load_fdt forget to zero errp. Fix it.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> ---
>  hw/core/loader-fit.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c
> index 953b16bc82..11e4fad595 100644
> --- a/hw/core/loader-fit.c
> +++ b/hw/core/loader-fit.c
> @@ -201,6 +201,7 @@ static int fit_load_fdt(const struct fit_loader *ldr, 
> const void *itb,
>      if (err == -ENOENT) {
>          load_addr = ROUND_UP(kernel_end, 64 * KiB) + (10 * MiB);
>          error_free(*errp);
> +        *errp = NULL;

Actually, let's drop my R-b - I think we have a bigger bug here.  We are
blindly dereferencing *errp even if the caller passed in NULL.  The
correct way to write this function requires either the use of local_err
or the addition of auto-propagation.

(In v2, you still had this bug - your addition of error_free_errp(errp)
would still blindly dereference *errp, unless you tweak the
implementation of error_free_errp to tolerate a NULL pointer input)

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]