[PATCH] printf: add __printf attribute
From: Tamir Duberstein
Date: Sat Dec 06 2025 - 08:19:31 EST
From: Tamir Duberstein <tamird@xxxxxxxxx>
This produces better diagnostics when incorrect inputs are passed.
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202512061600.89CKQ3ag-lkp@xxxxxxxxx/
Signed-off-by: Tamir Duberstein <tamird@xxxxxxxxx>
---
lib/tests/printf_kunit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
index 7617e5b8b02c..13e2e9afae3b 100644
--- a/lib/tests/printf_kunit.c
+++ b/lib/tests/printf_kunit.c
@@ -266,7 +266,7 @@ hash_pointer(struct kunit *kunittest)
KUNIT_EXPECT_MEMNEQ(kunittest, buf, PTR_STR, PTR_WIDTH);
}
-static void
+static void __printf(2, 3)
test_hashed(struct kunit *kunittest, const char *fmt, const void *p)
{
char buf[PLAIN_BUF_SIZE];
---
base-commit: 559e608c46553c107dbba19dae0854af7b219400
change-id: 20251206-printf-kunit-printf-attr-19369fc57bf0
Best regards,
--
Tamir Duberstein <tamird@xxxxxxxxx>