common: oftree: trim leading spaces from bootargs
PATCH 1/1 common: oftree: trim leading spaces from bootargs
When barebox concatenates all dynamic bootargs string for linux, if they are empty, the resulting string might be composed of only spaces. Currently, there is no check for such string and it leads to overwriting bootargs in the device tree by an empty string. To avoid this behavior, use skip_spaces to trim leading spaces and then check if the string is empty. If so, simply returns and don't patch device tree bootargs.
--- common/oftree.c | 4 ++++ 1 file changed, 4 insertions(+)
common/oftree.c +4 -0
@@ -151,6 +151,10 @@ static int of_fixup_bootargs(struct device_node *root, void *unused)if (!str)return 0 ; + str =skip_spaces (str); +if (strlen (str) ==0 ) +return 0 ; + node =of_create_node (root,"/chosen" );if (!node)return -ENOMEM ;
Signature · 7 lines
2.15.0.276.g89ea799 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 8 lines · Clement Leger
When barebox concatenates all dynamic bootargs string for linux, if they are empty, the resulting string might be composed of only spaces. Currently, there is no check for such string and it leads to overwriting bootargs in the device tree by an empty string. To avoid this behavior, use
skip_spacesto trim leading spaces and then check if the string is empty. If so, simply returns and don't patch device tree bootargs.
Quoted 4 lines
Signed-off-by Clement Leger <[email protected]>--- common/oftree.c | 4 ++++ 1 file changed, 4 insertions(+)
Applied, thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox