[sheepdog] [PATCH 2/3] checkpatch: show warning if sd_printf format string contains a newline

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Mon Feb 25 09:31:11 CET 2013


Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 script/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/script/checkpatch.pl b/script/checkpatch.pl
index 5f8bccf..3ce0db8 100755
--- a/script/checkpatch.pl
+++ b/script/checkpatch.pl
@@ -2883,6 +2883,12 @@ sub process {
 			}
 		    }
 		}
+
+# check for a newline in sd_printf
+		if ($rawline =~ /\b(sd_.?printf|panic).+[^\\]\\n"/) {
+		    WARN("NEWLINE_IN_SDPRINTF",
+			 "'\\n' is not required for $1 format string\n" . $herecurr);
+		}
 	}
 
 	# If we have no input at all, then there is nothing to report on
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list