From: Dwaipayan Ray <dwaipayanray1@gmail.com>
To: joe@perches.com
Cc: linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com,
Dwaipayan Ray <dwaipayanray1@gmail.com>
Subject: [PATCH] checkpatch: fix uninitialized return value in raw_line subroutine
Date: Sun, 25 Apr 2021 12:43:06 +0530 [thread overview]
Message-ID: <20210425071306.5114-1-dwaipayanray1@gmail.com> (raw)
In case the second argument to raw_line subroutine is 0,
$line remains uninitialized and is returned back to the callee.
If the callee tries to perform string concatenation with that
value, checkpatch throws an error:
Use of uninitialized value in concatenation (.) or string at
./scripts/checkpatch.pl line 1960.
Fix it by providing an empty string as the initial value
for $line.
Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 23697a6b1eaa..a98217360375 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1943,7 +1943,7 @@ sub raw_line {
my $offset = $linenr - 1;
$cnt++;
- my $line;
+ my $line = "";
while ($cnt) {
$line = $rawlines[$offset++];
next if (defined($line) && $line =~ /^-/);
--
2.30.0
reply other threads:[~2021-04-25 7:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210425071306.5114-1-dwaipayanray1@gmail.com \
--to=dwaipayanray1@gmail.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
/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
all inboxes | Powered by JetHome®