]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
board: ten64: Fix OOB read in ft_board_setup
authorFrancois Berder <fberder@outlook.fr>
Sat, 9 May 2026 19:24:17 +0000 (21:24 +0200)
committerPeng Fan <peng.fan@nxp.com>
Fri, 15 May 2026 11:28:31 +0000 (19:28 +0800)
base and size arrays can both contain up to total_memory_banks
elements.
This commit fixes the for loop condition to ensure that it does
not attempt to read past the end of both arrays.

Signed-off-by: Francois Berder <fberder@outlook.fr>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
board/traverse/ten64/ten64.c

index 5941ed11a603d330c5f9f2e5b9651eb2997c4e50..ac8c9a9a81a0afe12659a80b8a37b3d7fba37f9f 100644 (file)
@@ -285,7 +285,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
        }
 
        if (mc_memory_base != 0) {
-               for (i = 0; i <= total_memory_banks; i++) {
+               for (i = 0; i < total_memory_banks; i++) {
                        if (base[i] == 0 && size[i] == 0) {
                                base[i] = mc_memory_base;
                                size[i] = mc_memory_size;