checkpatch: handle comment/quote nesting correctly
authorAndy Whitcroft <apw@shadowen.org>
Thu, 16 Oct 2008 05:02:26 +0000 (22:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Oct 2008 18:21:36 +0000 (11:21 -0700)
Ensure that a close comment cannot incorrectly trigger in the middle of a
string.  Reported by Jaswinder Singh.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Jaswinder Singh <jaswinder@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index 5382f7287397d3aabd832a4f7f615216ce3d495e..18646f076a8409d40326a2549d1b78d4675b6b57 100755 (executable)
@@ -335,7 +335,7 @@ sub sanitise_line {
                        $off++;
                        next;
                }
-               if (substr($line, $off, 2) eq '*/') {
+               if ($sanitise_quote eq '*/' && substr($line, $off, 2) eq '*/') {
                        $sanitise_quote = '';
                        substr($res, $off, 2, "$;$;");
                        $off++;