From f3c05f20dcb09159141c8843d909a26997cc5f03 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Mon, 21 Sep 2020 09:11:35 +0200 Subject: common: misc: support strerror(err) for all err <= MAX_ERRNO We have a _LAST_ERRNO of 3 decimal digits. strerror(_LAST_ERRNO) is ok, but it's still possible that some code passes a non-error code int, which will overflow the static buffer. Play it safe and bump up the buffer size to at least 11 characters. This is enough to represent all integers, with only 7 characters more static storage. This way strerror(some_int_passed_by_mistake) will not invoke UB. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- common/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/misc.c b/common/misc.c index 1c7f937608..1a1cc071b4 100644 --- a/common/misc.c +++ b/common/misc.c @@ -22,6 +22,7 @@ #include #include #include +#include int errno; EXPORT_SYMBOL(errno); @@ -29,7 +30,7 @@ EXPORT_SYMBOL(errno); const char *strerror(int errnum) { - static char errno_string[10]; + static char errno_string[sizeof("error -2147483648")]; #ifdef CONFIG_ERRNO_MESSAGES char *str; -- cgit v1.2.3 From 9a0fa171d3582b75780bea703f4576a5d4d5a7a9 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 28 Sep 2020 10:29:53 +0200 Subject: Kallsyms: Cleanup whitespaces 96028fb099 ("Kallsyms: Also resolve global variables") introduced some whitespaces where should have been tabs. Fix this. Signed-off-by: Sascha Hauer --- common/kallsyms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common') diff --git a/common/kallsyms.c b/common/kallsyms.c index 2c16ab2884..f641903147 100644 --- a/common/kallsyms.c +++ b/common/kallsyms.c @@ -15,8 +15,8 @@ extern const unsigned long kallsyms_markers[] __attribute__((weak)); static inline int is_kernel_text(unsigned long addr) { - if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end) - return 1; + if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end) + return 1; return 0; } -- cgit v1.2.3 From 7450a4362d71b89f9886ef6dc856d569923a0f77 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Tue, 29 Sep 2020 12:58:19 +0200 Subject: common: debug_ll: remove reference to undefined Kconfig option The code was copied from the kernel, but we don't support the imx6sl. Drop the left-over. Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- common/Kconfig | 1 - 1 file changed, 1 deletion(-) (limited to 'common') diff --git a/common/Kconfig b/common/Kconfig index 9e6918189b..be03c0d5df 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1292,7 +1292,6 @@ config DEBUG_IMX_UART_PORT DEBUG_IMX51_UART || \ DEBUG_IMX53_UART || \ DEBUG_IMX6Q_UART || \ - DEBUG_IMX6SL_UART || \ DEBUG_IMX7D_UART || \ DEBUG_IMX8M_UART || \ DEBUG_VF610_UART -- cgit v1.2.3 From cac4e34f2da46798d77907ebcd4c11c770ed0f13 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Wed, 30 Sep 2020 15:24:51 +0200 Subject: shutdown: flush console on barebox shutdown Same as in the poweroff and restart path, we should make sure to properly drain the console devices when shutting down barebox. This fixes serial console corruption when the software running after barebox changes the peripheral configuration before all the characters have drained out of the FIFO. Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- common/startup.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'common') diff --git a/common/startup.c b/common/startup.c index ea7ce6b8da..60d1102edf 100644 --- a/common/startup.c +++ b/common/startup.c @@ -436,6 +436,8 @@ void shutdown_barebox(void) pr_debug("exitcall-> %pS\n", *exitcall); (*exitcall)(); } + + console_flush(); } BAREBOX_MAGICVAR_NAMED(autoboot_state, -- cgit v1.2.3