aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2023-03-24 08:55:19 +0100
committerPatrice Chotard <patrice.chotard@foss.st.com>2023-04-19 10:02:28 +0200
commitdaf07215e8c4aed16af81e1615396f5502040c1f (patch)
treebc6f4a5b69b81b1761c2751511defabd97feb28a /board
parentbb0352009822239044ac7f2eafcdff8c71d56ed2 (diff)
downloadu-boot-daf07215e8c4aed16af81e1615396f5502040c1f.zip
u-boot-daf07215e8c4aed16af81e1615396f5502040c1f.tar.gz
u-boot-daf07215e8c4aed16af81e1615396f5502040c1f.tar.bz2
stm32mp: fix various array bounds checks
In all these cases, the index on the LHS is immediately afterwards used to access the array appearing in the ARRAY_SIZE() on the RHS - so if that index is equal to the array size, we'll access one-past-the-end of the array. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'board')
-rw-r--r--board/st/stm32mp1/stm32mp1.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index ca8f025..1a1b184 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -872,7 +872,7 @@ int mmc_get_boot(void)
STM32_SDMMC3_BASE
};
- if (instance > ARRAY_SIZE(sdmmc_addr))
+ if (instance >= ARRAY_SIZE(sdmmc_addr))
return 0;
/* search associated sdmmc node in devicetree */