linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts/get_maintainer.pl: Fix possible infinite loop
@ 2010-02-23 17:31 Joe Perches
  2010-02-23 18:53 ` [PATCH V2] " Joe Perches
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Perches @ 2010-02-23 17:31 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML

If MAINTAINERS section entries are misformatted,
it was possible to have an infinite loop.

Correct the defect by always moving at least one entry
forward in parsing the MAINTAINERS file.

Signed-off-by: Joe Perches <joe@perches.com>
---
 scripts/get_maintainer.pl |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 2f3230d..4f2ec25 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -340,8 +340,11 @@ foreach my $file (@files) {
 	    }
 	}
 
-	$tvi += ($end - $start);
-
+	if ($end <= $start) {
+	    $tvi++;
+	} else {
+	    $tvi += ($end - $start);
+	}
     }
 
     foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {
-- 
1.7.0.14.g7e948



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH V2] scripts/get_maintainer.pl: Fix possible infinite loop
  2010-02-23 17:31 [PATCH] scripts/get_maintainer.pl: Fix possible infinite loop Joe Perches
@ 2010-02-23 18:53 ` Joe Perches
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2010-02-23 18:53 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML

This is simpler.

If MAINTAINERS section entries are misformatted,
it was possible to have an infinite loop.

Correct the defect by always moving the index
to the end of section + 1

Also, exit check for exclude as soon as possible.

Signed-off-by: Joe Perches <joe@perches.com>

 scripts/get_maintainer.pl |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 2f3230d..049c419 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -314,6 +314,7 @@ foreach my $file (@files) {
 		if ($type eq 'X') {
 		    if (file_match_pattern($file, $value)) {
 			$exclude = 1;
+			last;
 		    }
 		}
 	    }
@@ -340,8 +341,7 @@ foreach my $file (@files) {
 	    }
 	}
 
-	$tvi += ($end - $start);
-
+	$tvi = $end + 1;
     }
 
     foreach my $line (sort {$hash{$b} <=> $hash{$a}} keys %hash) {



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-23 18:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-23 17:31 [PATCH] scripts/get_maintainer.pl: Fix possible infinite loop Joe Perches
2010-02-23 18:53 ` [PATCH V2] " Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).