[RFC v2 4/9] hw/core/loader-fit: fix freeing errp in fit_load_fdt

Vladimir Sementsov-Ogievskiy posted 9 patches 6 years, 4 months ago
There is a newer version of this series
[RFC v2 4/9] hw/core/loader-fit: fix freeing errp in fit_load_fdt
Posted by Vladimir Sementsov-Ogievskiy 6 years, 4 months ago
fit_load_fdt forget to zero errp. Fix it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 hw/core/loader-fit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c
index 953b16bc82..fe5bcc6700 100644
--- a/hw/core/loader-fit.c
+++ b/hw/core/loader-fit.c
@@ -200,7 +200,7 @@ static int fit_load_fdt(const struct fit_loader *ldr, const void *itb,
     err = fit_image_addr(itb, img_off, "load", &load_addr, errp);
     if (err == -ENOENT) {
         load_addr = ROUND_UP(kernel_end, 64 * KiB) + (10 * MiB);
-        error_free(*errp);
+        error_free_errp(errp);
     } else if (err) {
         error_prepend(errp, "unable to read FDT load address from FIT: ");
         ret = err;
-- 
2.21.0


Re: [RFC v2 4/9] hw/core/loader-fit: fix freeing errp in fit_load_fdt
Posted by Eric Blake 6 years, 4 months ago
On 9/23/19 11:12 AM, Vladimir Sementsov-Ogievskiy wrote:
> fit_load_fdt forget to zero errp. Fix it.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  hw/core/loader-fit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Independent bug fix.  Either we take the (fixed) 2-3 (to rely on the new
error_free_errp), or you could open-code the assignment of errp=NULL to
take this on its own, regardless of the hfate of the rest of the series.

Reviewed-by: Eric Blake <eblake@redhat.com>

> diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c
> index 953b16bc82..fe5bcc6700 100644
> --- a/hw/core/loader-fit.c
> +++ b/hw/core/loader-fit.c
> @@ -200,7 +200,7 @@ static int fit_load_fdt(const struct fit_loader *ldr, const void *itb,
>      err = fit_image_addr(itb, img_off, "load", &load_addr, errp);
>      if (err == -ENOENT) {
>          load_addr = ROUND_UP(kernel_end, 64 * KiB) + (10 * MiB);
> -        error_free(*errp);
> +        error_free_errp(errp);
>      } else if (err) {
>          error_prepend(errp, "unable to read FDT load address from FIT: ");
>          ret = err;
> 

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