From: Heiko Stuebner <heiko@sntech.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] fdtdec: protect against another NULL phandlep in fdtdec_add_reserved_memory()
Date: Tue, 8 Oct 2019 02:22:05 +0200 [thread overview]
Message-ID: <20191008002207.14396-1-heiko@sntech.de> (raw)
The change adding fdtdec_add_reserved_memory() already protected the added
phandle against the phandlep being NULL - making the phandlep var optional.
But in the early code checking for an already existing carveout this check
was not done and thus the phandle assignment could run into trouble,
so add a check there as well, which makes the function still return
sucessfully if a matching region is found, even though no-one wants to
work with the phandle.
Fixes: c9222a08b3f7 ("fdtdec: Implement fdtdec_add_reserved_memory()")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
lib/fdtdec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 74525c84e7..17455c5506 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1363,7 +1363,8 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename,
}
if (addr == carveout->start && (addr + size) == carveout->end) {
- *phandlep = fdt_get_phandle(blob, node);
+ if (phandlep)
+ *phandlep = fdt_get_phandle(blob, node);
return 0;
}
}
--
2.23.0
next reply other threads:[~2019-10-08 0:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-08 0:22 Heiko Stuebner [this message]
2019-10-08 0:22 ` [U-Boot] [PATCH 2/3] fdtdec: only create phandle if caller wants it in fdtdec_add_reserved_memory() Heiko Stuebner
2019-10-22 0:16 ` Simon Glass
2019-10-08 0:22 ` [U-Boot] [PATCH 3/3] image: fdt: copy possible optee nodes to a loaded devicetree Heiko Stuebner
2019-10-22 0:17 ` Simon Glass
2019-10-22 12:08 ` Heiko Stübner
2019-10-22 20:02 ` Heiko Stübner
2019-10-22 6:16 ` Jens Wiklander
2019-10-22 0:16 ` [U-Boot] [PATCH 1/3] fdtdec: protect against another NULL phandlep in fdtdec_add_reserved_memory() Simon Glass
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=20191008002207.14396-1-heiko@sntech.de \
--to=heiko@sntech.de \
--cc=u-boot@lists.denx.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