diff --git a/tools/checkpatch.sh b/tools/checkpatch.sh index 3fbc5598603..18a9848a6c1 100755 --- a/tools/checkpatch.sh +++ b/tools/checkpatch.sh @@ -56,7 +56,7 @@ check_file() { check_ranges() { while read; do - if [[ $REPLY =~ \+\+\+\ (b/)?([^[:blank:]]+).* ]]; then + if [[ $REPLY =~ ^(\+\+\+\ (b/)?([^[:blank:]]+).*)$ ]]; then if [ "$ranges" != "" ]; then if [ $range != 0 ]; then check_file $ranges $path 2>&1 @@ -64,7 +64,7 @@ check_ranges() { check_file $path 2>&1 fi fi - path=${BASH_REMATCH[2]} + path=${BASH_REMATCH[3]} ranges="" elif [[ $REPLY =~ @@\ -[0-9]+(,[0-9]+)?\ \+([0-9]+,[0-9]+)?\ @@.* ]]; then ranges+="-r ${BASH_REMATCH[2]} "