Powered by Linux
[PATCH 8/9] check_kernel_printf.c: actually allow printk level via %c — Semantic Matching Tool

[PATCH 8/9] check_kernel_printf.c: actually allow printk level via %c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The comment already explained that one sometimes sees the level chosen
via a %c argument, yet we still printed false positives. Add a check
for KERN_SOH_ASCII being followed by "%c" and don't complain in that
case.

Signed-off-by: Rasmus Villemoes <rv@xxxxxxxxxxxxxxxxxx>
---
 check_kernel_printf.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/check_kernel_printf.c b/check_kernel_printf.c
index abba904..b6c387b 100644
--- a/check_kernel_printf.c
+++ b/check_kernel_printf.c
@@ -795,7 +795,9 @@ check_format_string(const char *fmt, const char *caller)
 			 * "%c...". printk explicitly supports
 			 * this.
 			 */
-			if (!(('0' <= f[1] && f[1] <= '7') || f[1] == 'd'))
+			if (!(('0' <= f[1] && f[1] <= '7') ||
+			      f[1] == 'd' ||
+			      (f[1] == '%' && f[2] == 'c')))
 				sm_msg("warn: invalid KERN_* level: KERN_SOH_ASCII followed by '\\x%02x'", (unsigned char)f[1]);
 			break;
 		case '\t':
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe smatch" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux