aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2023-07-26 09:59:52 +0300
committerTom Rini <trini@konsulko.com>2023-08-08 17:05:43 -0400
commitd7a92e9cb22497562b1632aebc0d625b17bbfd51 (patch)
treed56e5e169d3716b8e12cc1d394a6a0203d58153d
parentc331efd08766aa610aa14c957856ef5b0fa915df (diff)
downloadu-boot-d7a92e9cb22497562b1632aebc0d625b17bbfd51.zip
u-boot-d7a92e9cb22497562b1632aebc0d625b17bbfd51.tar.gz
u-boot-d7a92e9cb22497562b1632aebc0d625b17bbfd51.tar.bz2
fdt: off by one in ofnode_lookup_fdt()
The "oftree_count" is the number of entries which have been set in the oftree_list[] array. If all the entries have been initialized then this off by one would result in reading one element beyond the end of the array. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--drivers/core/ofnode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 8df16e5..a4dc9bd 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -103,7 +103,7 @@ void *ofnode_lookup_fdt(ofnode node)
if (gd->flags & GD_FLG_RELOC) {
uint i = OFTREE_TREE_ID(node.of_offset);
- if (i > oftree_count) {
+ if (i >= oftree_count) {
log_debug("Invalid tree ID %x\n", i);
return NULL;
}