[PATCH] scripts: kernel-doc: Check existence of FILE arg

From: Akira Yokosawa
Date: Wed Feb 23 2022 - 01:07:39 EST


Subject: [PATCH] scripts: kernel-doc: Check existence of FILE arg

Currently, when no FILE argument is given following switches such
as -man, -rst, and -none, kernel-doc ends up in the error of (long
msg from perl folded):

Use of uninitialized value $ARGV[0] in pattern match (m//)
at ./scripts/kernel-doc line 438.

Fix this by adding an existence check at the bottom of the while
loop parsing command switches and call usage() if there remains
no argument.

While at it, fix inconsistent indent by spaces in the previous
block.

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
Cc: Jonathan Corbet <corbet@xxxxxxx>
Cc: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Cc: linux-doc@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
Hi Jon,

I noticed this minor issue while reviewing Tomasz's patch series.
This patch is relative to docs-next as of 2022.02.22.

Thanks, Akira
--
scripts/kernel-doc | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 3106b7536b89..faefe2977f0e 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -494,7 +494,11 @@ while ($ARGV[0] =~ m/^--?(.*)/) {
}
} else {
# Unknown argument
- usage();
+ usage();
+ }
+ if ($#ARGV < 0){
+ print "No FILE!\n";
+ usage();
}
}


base-commit: b62ef3a1cca0553613adce16515f3640400725b4
--
2.17.1