lib/test_printf.c: don't BUG
authorRasmus Villemoes <[email protected]>
Sat, 16 Jan 2016 00:58:50 +0000 (16:58 -0800)
committerLinus Torvalds <[email protected]>
Sat, 16 Jan 2016 19:17:27 +0000 (11:17 -0800)
BUG is a completely unnecessarily big hammer, and we're more likely to
get the internal bug reported if we just pr_err() and ensure the test
suite fails.

Signed-off-by: Rasmus Villemoes <[email protected]>
Acked-by: Kees Cook <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Andy Shevchenko <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Joe Perches <[email protected]>
Cc: Maurizio Lombardi <[email protected]>
Cc: Tejun Heo <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
lib/test_printf.c

index c5a666af9ba5a4536edd58b626f2b0b339b2138d..9232a2add28cf8fe505515e34020f20dcfb6573f 100644 (file)
@@ -91,7 +91,12 @@ __test(const char *expect, int elen, const char *fmt, ...)
        int rand;
        char *p;
 
-       BUG_ON(elen >= BUF_SIZE);
+       if (elen >= BUF_SIZE) {
+               pr_err("error in test suite: expected output length %d too long. Format was '%s'.\n",
+                      elen, fmt);
+               failed_tests++;
+               return;
+       }
 
        va_start(ap, fmt);