Skip to content

Commit 6340d61

Browse files
tamirdkees
authored andcommitted
scanf: remove redundant debug logs
Remove `pr_debug` calls which emit information already contained in `pr_warn` calls that occur on test failure. This reduces unhelpful test verbosity. Note that a `pr_debug` removed from `_check_numbers_template` appears to have been the only guard against silent false positives, but in fact this condition is handled in `_test`; it is only possible for `n_args` to be `0` in `_check_numbers_template` if the test explicitly expects it *and* `vsscanf` returns `0`, matching the expectation. Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Tamir Duberstein <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent 5866730 commit 6340d61

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

lib/test_scanf.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ _test(const char *file, const int line, check_fn fn, const void *check_data, con
6262

6363
#define _check_numbers_template(arg_fmt, expect, str, fmt, n_args, ap) \
6464
do { \
65-
pr_debug("\"%s\", \"%s\" ->\n", str, fmt); \
6665
for (; n_args > 0; n_args--, expect++) { \
6766
typeof(*expect) got = *va_arg(ap, typeof(expect)); \
68-
pr_debug("\t" arg_fmt "\n", got); \
6967
if (got != *expect) { \
7068
pr_warn("%s:%d, vsscanf(\"%s\", \"%s\", ...) expected " arg_fmt " got " arg_fmt "\n", \
7169
file, line, str, fmt, *expect, got); \
@@ -689,7 +687,6 @@ do { \
689687
total_tests++; \
690688
len = snprintf(test_buffer, BUF_SIZE, gen_fmt, expect); \
691689
got = (fn)(test_buffer, &endp, base); \
692-
pr_debug(#fn "(\"%s\", %d) -> " gen_fmt "\n", test_buffer, base, got); \
693690
if (got != (expect)) { \
694691
fail = true; \
695692
pr_warn(#fn "(\"%s\", %d): got " gen_fmt " expected " gen_fmt "\n", \

0 commit comments

Comments
 (0)