From: Manish Narani <manish.narani@xilinx.com>
To: <apw@canonical.com>, <joe@perches.com>, <linux-kernel@vger.kernel.org>
Cc: <anirudh@xilinx.com>, <sgoud@xilinx.com>, <svemula@xilinx.com>,
Manish Narani <manish.narani@xilinx.com>
Subject: [PATCH] checkpatch: Resolve improper warning for krealloc arg reuse
Date: Wed, 18 Jul 2018 19:25:48 +0530 [thread overview]
Message-ID: <1531922148-7423-1-git-send-email-manish.narani@xilinx.com> (raw)
Correct the check for reuse of krealloc. It gives false warning when a
structure member variable name and krealloc argument name is same.
For Example:
{
...
abc.def_var = krealloc(def_var, sizeof(*def_var),
GFP_KERNEL);
...
}
$ ./scripts/checkpatch.pl -f file.c
WARNING: Reusing the krealloc arg is almost always a bug
+ abc.def_var = krealloc(def_var, sizeof(*def_var),
This patch resolves the above false warning.
Signed-off-by: Manish Narani <manish.narani@xilinx.com>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 447857f..db9b666 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6119,7 +6119,7 @@ sub process {
# check for krealloc arg reuse
if ($^V && $^V ge 5.10.0 &&
- $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/) {
+ $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*krealloc\s*\(\s*\1\s*,/ && $line !~ m/[\.|\-\>].*\s*\=\s*.*/) {
WARN("KREALLOC_ARG_REUSE",
"Reusing the krealloc arg is almost always a bug\n" . $herecurr);
}
--
2.1.1
next reply other threads:[~2018-07-18 13:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 13:55 Manish Narani [this message]
2018-07-18 15:50 ` Joe Perches
2018-07-18 17:46 ` Joe Perches
2018-07-22 17:51 ` [PATCH] checkpatch: Fix krealloc reuse test Joe Perches
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=1531922148-7423-1-git-send-email-manish.narani@xilinx.com \
--to=manish.narani@xilinx.com \
--cc=anirudh@xilinx.com \
--cc=apw@canonical.com \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sgoud@xilinx.com \
--cc=svemula@xilinx.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®