[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH v2 3/4] hw/arm/sysbus-fdt: Replace er
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH v2 3/4] hw/arm/sysbus-fdt: Replace error_setg(&error_fatal) by error_report() + exit() |
Date: |
Fri, 08 Jun 2018 08:27:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) |
Philippe Mathieu-Daudé <address@hidden> writes:
> Use error_report() + exit() instead of error_setg(&error_fatal),
> as suggested by the "qapi/error.h" documentation:
>
> Please don't error_setg(&error_fatal, ...), use error_report() and
> exit(), because that's more obvious.
>
> This fixes CID 1352173:
> "Passing null pointer dt_name to qemu_fdt_node_path, which dereferences
> it."
>
> And this also fixes:
>
> hw/arm/sysbus-fdt.c:322:9: warning: Array access (from variable
> 'node_path') results in a null pointer dereference
> if (node_path[1]) {
> ^~~~~~~~~~~~
>
> Fixes: Coverity CID 1352173 (Dereference after null check)
You lost
Suggested-by: Eric Blake <address@hidden>
Intentional?
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> hw/arm/sysbus-fdt.c | 42 +++++++++++++++++++++++-------------------
> 1 file changed, 23 insertions(+), 19 deletions(-)
>
> diff --git a/hw/arm/sysbus-fdt.c b/hw/arm/sysbus-fdt.c
> index e4c492ea44..8e2784fa11 100644
> --- a/hw/arm/sysbus-fdt.c
> +++ b/hw/arm/sysbus-fdt.c
> @@ -91,7 +91,7 @@ static void copy_properties_from_host(HostProperty *props,
> int nb_props,
> r = qemu_fdt_getprop(host_fdt, node_path,
> props[i].name,
> &prop_len,
> - props[i].optional ? &err : &error_fatal);
> + &err);
> if (r) {
> qemu_fdt_setprop(guest_fdt, nodename,
> props[i].name, r, prop_len);
> @@ -102,6 +102,7 @@ static void copy_properties_from_host(HostProperty
> *props, int nb_props,
> } else {
> error_free(err);
> }
> + assert(props[i].optional); /* mandatory property not found */
> }
> }
> }
This is not the conversion the commit message promised: it replaces
exit(1) by abort(). Why?
[Remainder of the patch is unchanged]