diff options
author | Tom Rini <trini@konsulko.com> | 2022-12-19 09:29:55 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-12-21 13:09:01 -0500 |
commit | 14f43797d0a696248c09d298e2f2809dded345ba (patch) | |
tree | 23fc5bc462689f07f389cc0b8e7f7bedd35253ff /board/Marvell | |
parent | 9c955393f7a27ded250fef7688e0065b44a3343f (diff) | |
parent | 2243922edca9f56a9d5519b9d6e36f5d7a18434d (diff) | |
download | u-boot-14f43797d0a696248c09d298e2f2809dded345ba.zip u-boot-14f43797d0a696248c09d298e2f2809dded345ba.tar.gz u-boot-14f43797d0a696248c09d298e2f2809dded345ba.tar.bz2 |
Merge tag 'v2023.01-rc4' into next
Prepare v2023.01-rc4
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'board/Marvell')
-rw-r--r-- | board/Marvell/mvebu_armada-37xx/board.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c index 45fe3e5..3ab6e88 100644 --- a/board/Marvell/mvebu_armada-37xx/board.c +++ b/board/Marvell/mvebu_armada-37xx/board.c @@ -99,9 +99,16 @@ int board_late_init(void) if (!of_machine_is_compatible("globalscale,espressobin")) return 0; - /* Find free buffer in default_environment[] for new variables */ - while (*ptr != '\0' && *(ptr+1) != '\0') ptr++; - ptr += 2; + /* + * Find free space for new variables in default_environment[] array. + * Free space is after the last variable, each variable is termined + * by nul byte and after the last variable is additional nul byte. + * Move ptr to the position where new variable can be filled. + */ + while (*ptr != '\0') { + do { ptr++; } while (*ptr != '\0'); + ptr++; + } /* * Ensure that 'env default -a' does not erase permanent MAC addresses @@ -145,6 +152,13 @@ int board_late_init(void) strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-emmc.dtb"); else strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin.dtb"); + ptr += strlen(ptr) + 1; + + /* + * After the last variable (which is nul term string) append another nul + * byte which terminates the list. So everything after ptr is ignored. + */ + *ptr = '\0'; return 0; } |