[PATCH 2/7] checkpatch: suppress errors triggered by short patch

From: Andy Whitcroft
Date: Tue Sep 02 2008 - 13:26:22 EST


When the last hunk of a patch is short it will trigger errors from
checkpatch:

Use of uninitialized value in pattern match (m//)
at /usr/local/bin/checkpatch.pl line 394.
Use of uninitialized value in concatenation (.) or string
at /usr/local/bin/checkpatch.pl line 397.
Use of uninitialized value in pattern match (m//)

Avoid touching beyond the last line. Reported by Julien Brunel.

Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxx>
Cc: Julien Brunel <brunel@xxxxxxx>
---
scripts/checkpatch.pl | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 457f874..5382f72 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -408,6 +408,7 @@ sub ctx_statement_block {
# context.
if ($off >= $len) {
for (; $remain > 0; $line++) {
+ last if (!defined $lines[$line]);
next if ($lines[$line] =~ /^-/);
$remain--;
$loff = $len;
--
1.6.0.rc1.258.g80295

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/