scripts/get_maintainer.pl: Fix possible infinite loop
Joe Perches
maintainerPATCH 1/1 scripts/get_maintainer.pl: Fix possible infinite loop
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 <[email protected]>
--- scripts/get_maintainer.pl | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
scripts/get_maintainer.pl +5 -2
@@ -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) {
Signature · 1 line
1.7.0.14.g7e948
Joe Perches
maintainerPATCH v2 1/1 scripts/get_maintainer.pl: Fix possible infinite loop
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 <[email protected]>
scripts/get_maintainer.pl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
scripts/get_maintainer.pl +2 -2
@@ -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) {