[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20160819123026.GV30909@codeblueprint.co.uk>
Date: Fri, 19 Aug 2016 13:30:26 +0100
From: Matt Fleming <matt@...eblueprint.co.uk>
To: Andrzej Hajda <a.hajda@...sung.com>
Cc: "open list:EXTENSIBLE FIRMWARE INTERFACE (EFI)"
<linux-efi@...r.kernel.org>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
open list <linux-kernel@...r.kernel.org>,
Shannon Zhao <shannon.zhao@...aro.org>,
Leif Lindholm <leif.lindholm@...aro.org>,
Mark Salter <msalter@...hat.com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>
Subject: Re: [PATCH] efi: fix handling error value in fdt_find_uefi_params
On Wed, 17 Aug, at 12:00:40PM, Andrzej Hajda wrote:
> of_get_flat_dt_subnode_by_name can return negative value in case of error.
>
> The problem has been detected using semantic patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
>
> Signed-off-by: Andrzej Hajda <a.hajda@...sung.com>
> ---
> drivers/firmware/efi/efi.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index 5a2631a..7dd2e2d 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -657,9 +657,12 @@ static int __init fdt_find_uefi_params(unsigned long node, const char *uname,
> }
>
> if (subnode) {
> - node = of_get_flat_dt_subnode_by_name(node, subnode);
> - if (node < 0)
> + int err = of_get_flat_dt_subnode_by_name(node, subnode);
> +
> + if (err < 0)
> return 0;
> +
> + node = err;
> }
>
> return __find_uefi_params(node, info, dt_params[i].params);
> --
> 1.9.1
Looks good to me. Thanks, applied.
Powered by blists - more mailing lists