public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Randy Dunlap <rdunlap@infradead.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH] scripts: kernel-doc: Check existence of FILE arg
Date: Wed, 23 Feb 2022 15:07:30 +0900	[thread overview]
Message-ID: <1c71e5d2-f87e-6c8e-6176-e5ce42e4d41b@gmail.com> (raw)

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@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
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



             reply	other threads:[~2022-02-23  6:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23  6:07 Akira Yokosawa [this message]
2022-02-23 13:47 ` [PATCH] scripts: kernel-doc: Check existence of FILE arg Tomasz Warniełło
2022-02-23 13:59   ` Akira Yokosawa
2022-02-23 14:17     ` Tomasz Warniełło
2022-02-23 14:36       ` Jonathan Corbet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c71e5d2-f87e-6c8e-6176-e5ce42e4d41b@gmail.com \
    --to=akiyks@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox