]> www.infradead.org Git - users/dwmw2/linux.git/commit
selftests/nolibc: avoid passing NULL to printf("%s")
authorThomas Weißschuh <linux@weissschuh.net>
Wed, 7 Aug 2024 21:51:44 +0000 (23:51 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Mon, 12 Aug 2024 20:22:13 +0000 (22:22 +0200)
commitf1a58f61d88642ae1e6e97e9d72d73bc70a93cb8
tree034a87ff84bf9775a61e28f2a54acb715f39f437
parentddae1d7fab8c5dc5d12da120dc410c4f374d37c3
selftests/nolibc: avoid passing NULL to printf("%s")

Clang on higher optimization levels detects that NULL is passed to
printf("%s") and warns about it.
While printf() from nolibc gracefully handles that NULL,
it is undefined behavior as per POSIX, so the warning is reasonable.
Avoid the warning by transforming NULL into a non-NULL placeholder.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20240807-nolibc-llvm-v2-8-c20f2f5fc7c2@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
tools/testing/selftests/nolibc/nolibc-test.c