Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1472382 > unrolled thread
| Started by | Matt Fleming <matt@codeblueprint.co.uk> |
|---|---|
| First post | 2016-08-30 12:10 +0200 |
| Last post | 2016-09-05 12:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 6/6] efi/fdt: Fix handling error value in fdt_find_uefi_params Matt Fleming <matt@codeblueprint.co.uk> - 2016-08-30 12:10 +0200
[PATCH v2] efi: fix handling error value in fdt_find_uefi_params Andrzej Hajda <a.hajda@samsung.com> - 2016-08-30 12:50 +0200
Re: [PATCH v2] efi: fix handling error value in fdt_find_uefi_params Matt Fleming <matt@codeblueprint.co.uk> - 2016-09-05 12:30 +0200
| From | Matt Fleming <matt@codeblueprint.co.uk> |
|---|---|
| Date | 2016-08-30 12:10 +0200 |
| Subject | Re: [PATCH 6/6] efi/fdt: Fix handling error value in fdt_find_uefi_params |
| Message-ID | <sbO9r-3ob-19@gated-at.bofh.it> |
On Mon, 22 Aug, at 06:45:08PM, Ingo Molnar wrote: > > * Matt Fleming <matt@codeblueprint.co.uk> wrote: > > > From: Andrzej Hajda <a.hajda@samsung.com> > > > > of_get_flat_dt_subnode_by_name can return negative value in case of error. > > ... which is a problem because <X>, and we solve it by doing <Y>? Andrzej, could you please provide an answer to Ingo's question?
[toc] | [next] | [standalone]
| From | Andrzej Hajda <a.hajda@samsung.com> |
|---|---|
| Date | 2016-08-30 12:50 +0200 |
| Subject | [PATCH v2] efi: fix handling error value in fdt_find_uefi_params |
| Message-ID | <sbOMa-3Ft-15@gated-at.bofh.it> |
| In reply to | #1472382 |
of_get_flat_dt_subnode_by_name can return negative value in case of error.
Assigning the result to unsigned variable and checking if the variable
is lesser than zero is incorrect and always false.
The patch fixes it by using signed variable to check the result.
The problem has been detected using semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
Signed-off-by: Andrzej Hajda <a.hajda@samsung.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
[toc] | [prev] | [next] | [standalone]
| From | Matt Fleming <matt@codeblueprint.co.uk> |
|---|---|
| Date | 2016-09-05 12:30 +0200 |
| Subject | Re: [PATCH v2] efi: fix handling error value in fdt_find_uefi_params |
| Message-ID | <sdZk5-2uu-7@gated-at.bofh.it> |
| In reply to | #1472404 |
On Tue, 30 Aug, at 12:41:37PM, Andrzej Hajda wrote:
> of_get_flat_dt_subnode_by_name can return negative value in case of error.
> Assigning the result to unsigned variable and checking if the variable
> is lesser than zero is incorrect and always false.
> The patch fixes it by using signed variable to check the result.
>
> The problem has been detected using semantic patch
> scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.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);
Thanks Andrzej, applied.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web