From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: Joe Perches <joe@perches.com>,
apw@canonical.com, dwaipayanray1@gmail.com,
lukas.bulwahn@gmail.com
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] checkpatch: Improve ALLOC_ARRAY_ARGS test
Date: Fri, 16 Apr 2021 18:51:09 +0200 [thread overview]
Message-ID: <ec273f46-6709-a1cd-7871-1e1d67fab7dd@wanadoo.fr> (raw)
In-Reply-To: <decdb749f0192bd886faa7e8470795fb2644e4f8.camel@perches.com>
Le 16/04/2021 à 18:11, Joe Perches a écrit :
> On Fri, 2021-04-16 at 17:58 +0200, Christophe JAILLET wrote:
>> The devm_ variant of 'kcalloc()' and 'kmalloc_array()' are not tested
>> Add the corresponding check.
> []
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>> @@ -7006,9 +7006,9 @@ sub process {
>> }
>>
>>
>> # check for alloc argument mismatch
>> - if ($line =~ /\b(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) {
>> + if ($line =~ /\b(devm_|)(kcalloc|kmalloc_array)\s*\(\s*sizeof\b/) {
>
> Perhaps nicer using
Indeed, much better.
I'll send a V2.
Thx for the feedback.
CJ
>
> if ($line =~ /\b((?:devm_)?(?:kcalloc|kmalloc_array))\s*\*\s*sizeof\b/) {
>
>> WARN("ALLOC_ARRAY_ARGS",
>> - "$1 uses number as first arg, sizeof is generally wrong\n" . $herecurr);
>> + "$1$2 uses number as first arg, sizeof is generally wrong\n" . $herecurr);
>
> So there's only one capture group and this line doesn't need to be changed.
>
>
>
next prev parent reply other threads:[~2021-04-16 16:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 15:58 Christophe JAILLET
2021-04-16 16:11 ` Joe Perches
2021-04-16 16:51 ` Christophe JAILLET [this message]
2021-04-16 17:03 ` Joe Perches
2021-04-16 18:03 ` Christophe JAILLET
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=ec273f46-6709-a1cd-7871-1e1d67fab7dd@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=apw@canonical.com \
--cc=dwaipayanray1@gmail.com \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--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®