linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Fleming <matt@codeblueprint.co.uk>
To: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H . Peter Anvin" <hpa@zytor.com>
Cc: Andrzej Hajda <a.hajda@samsung.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	Mark Salter <msalter@redhat.com>,
	Shannon Zhao <shannon.zhao@linaro.org>
Subject: [PATCH 6/6] efi/fdt: Fix handling error value in fdt_find_uefi_params
Date: Fri, 19 Aug 2016 21:35:04 +0100	[thread overview]
Message-ID: <1471638904-3494-7-git-send-email-matt@codeblueprint.co.uk> (raw)
In-Reply-To: <1471638904-3494-1-git-send-email-matt@codeblueprint.co.uk>

From: Andrzej Hajda <a.hajda@samsung.com>

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@samsung.com>
Cc: Shannon Zhao <shannon.zhao@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Mark Salter <msalter@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
 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 5a2631af7410..7dd2e2d37231 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);
-- 
2.7.3

  parent reply	other threads:[~2016-08-19 20:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19 20:34 [GIT PULL 0/6] EFI urgent fixes Matt Fleming
2016-08-19 20:34 ` [PATCH 1/6] efi: Make for_each_efi_memory_desc_in_map() cope with running on Xen Matt Fleming
2016-08-19 20:35 ` [PATCH 2/6] efi/libstub: Allocate headspace in efi_get_memory_map() Matt Fleming
2016-08-22 16:37   ` Ingo Molnar
2016-08-19 20:35 ` [PATCH 3/6] efi/libstub: Introduce ExitBootServices helper Matt Fleming
     [not found]   ` <1471638904-3494-4-git-send-email-matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-08-22 16:41     ` Ingo Molnar
2016-08-19 20:35 ` [PATCH 4/6] efi/libstub: Use efi_exit_boot_services() in FDT Matt Fleming
2016-08-22 16:43   ` Ingo Molnar
2016-08-19 20:35 ` [PATCH 5/6] x86/efi: Use efi_exit_boot_services() Matt Fleming
2016-08-19 20:35 ` Matt Fleming [this message]
2016-08-22 16:45   ` [PATCH 6/6] efi/fdt: Fix handling error value in fdt_find_uefi_params Ingo Molnar
     [not found]     ` <20160822164508.GD11327-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-08-30 10:07       ` Matt Fleming
     [not found]         ` <20160830100742.GA32579-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-08-30 10:41           ` [PATCH v2] efi: fix " Andrzej Hajda
     [not found]             ` <1472553697-27984-1-git-send-email-a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-09-05 10:27               ` Matt Fleming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471638904-3494-7-git-send-email-matt@codeblueprint.co.uk \
    --to=matt@codeblueprint.co.uk \
    --cc=a.hajda@samsung.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=hpa@zytor.com \
    --cc=leif.lindholm@linaro.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=msalter@redhat.com \
    --cc=shannon.zhao@linaro.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).