* [PATCH] checkpatch: add *_ON_STACK to $declaration_macros
@ 2017-06-27 7:55 Gilad Ben-Yossef
2017-12-20 9:41 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Gilad Ben-Yossef @ 2017-06-27 7:55 UTC (permalink / raw)
To: Andy Whitcroft, Joe Perches, linux-kernel; +Cc: Ofir Drang, linux-crypto
Add the crypto API *_ON_STACK to $declaration_macros.
Resolves the following false warning:
WARNING: Missing a blank line after declarations
+ int err;
+ SHASH_DESC_ON_STACK(desc, ctx_p->shash_tfm);
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
---
scripts/checkpatch.pl | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4b9569f..b42eb62 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -733,6 +733,7 @@ our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant|$String)};
our $declaration_macros = qr{(?x:
(?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
(?:$Storage\s+)?LIST_HEAD\s*\(|
+ (?:$Storage\s+)?[A-Z_]*_ON_STACK\(|
(?:$Storage\s+)?${Type}\s+uninitialized_var\s*\(
)};
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] checkpatch: add *_ON_STACK to $declaration_macros
2017-06-27 7:55 [PATCH] checkpatch: add *_ON_STACK to $declaration_macros Gilad Ben-Yossef
@ 2017-12-20 9:41 ` Joe Perches
2018-01-08 8:22 ` Gilad Ben-Yossef
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2017-12-20 9:41 UTC (permalink / raw)
To: Gilad Ben-Yossef, Andy Whitcroft, linux-kernel; +Cc: Ofir Drang, linux-crypto
On Tue, 2017-06-27 at 10:55 +0300, Gilad Ben-Yossef wrote:
> Add the crypto API *_ON_STACK to $declaration_macros.
>
> Resolves the following false warning:
>
> WARNING: Missing a blank line after declarations
> + int err;
> + SHASH_DESC_ON_STACK(desc, ctx_p->shash_tfm);
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -733,6 +733,7 @@ our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant|$String)};
> our $declaration_macros = qr{(?x:
> (?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
> (?:$Storage\s+)?LIST_HEAD\s*\(|
> + (?:$Storage\s+)?[A-Z_]*_ON_STACK\(|
A few things:
The crypto _ON_STACK declarations cannot have a $Storage type.
There should be a \s* between the ON_STACK and the open parenthesis
There are other _ON_STACK types than the crypto uses
$ grep -rP --include=*.[ch] -oh "\b[A-Z_]+_ON_STACK\b" * | \
sort | uniq -c | sort -rn
68 SKCIPHER_REQUEST_ON_STACK
45 SHASH_DESC_ON_STACK
10 AHASH_REQUEST_ON_STACK
4 PC_LOC_ON_STACK
4 DECLARE_DPM_WATCHDOG_ON_STACK
3 HISI_SAS_DECLARE_RST_WORK_ON_STACK
3 CONFIG_ARCH_TASK_STRUCT_ON_STACK
1 PT_SIZE_ON_STACK
1 ALLOC_PT_GPREGS_ON_STACK
So perhaps:
(?:SKCIPHER_REQUEST|SHASH_DESC|AHASH_REQUEST)_ON_STACK\s*\(
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] checkpatch: add *_ON_STACK to $declaration_macros
2017-12-20 9:41 ` Joe Perches
@ 2018-01-08 8:22 ` Gilad Ben-Yossef
0 siblings, 0 replies; 3+ messages in thread
From: Gilad Ben-Yossef @ 2018-01-08 8:22 UTC (permalink / raw)
To: Joe Perches
Cc: Andy Whitcroft, Linux kernel mailing list, Ofir Drang,
Linux Crypto Mailing List
On Wed, Dec 20, 2017 at 11:41 AM, Joe Perches <joe@perches.com> wrote:
> On Tue, 2017-06-27 at 10:55 +0300, Gilad Ben-Yossef wrote:
>> Add the crypto API *_ON_STACK to $declaration_macros.
>>
>> Resolves the following false warning:
>>
>> WARNING: Missing a blank line after declarations
>> + int err;
>> + SHASH_DESC_ON_STACK(desc, ctx_p->shash_tfm);
> []
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>> @@ -733,6 +733,7 @@ our $FuncArg = qr{$Typecast{0,1}($LvalOrFunc|$Constant|$String)};
>> our $declaration_macros = qr{(?x:
>> (?:$Storage\s+)?(?:[A-Z_][A-Z0-9]*_){0,2}(?:DEFINE|DECLARE)(?:_[A-Z0-9]+){1,6}\s*\(|
>> (?:$Storage\s+)?LIST_HEAD\s*\(|
>> + (?:$Storage\s+)?[A-Z_]*_ON_STACK\(|
>
> A few things:
>
> The crypto _ON_STACK declarations cannot have a $Storage type.
>
> There should be a \s* between the ON_STACK and the open parenthesis
>
> There are other _ON_STACK types than the crypto uses
>
> $ grep -rP --include=*.[ch] -oh "\b[A-Z_]+_ON_STACK\b" * | \
> sort | uniq -c | sort -rn
> 68 SKCIPHER_REQUEST_ON_STACK
> 45 SHASH_DESC_ON_STACK
> 10 AHASH_REQUEST_ON_STACK
> 4 PC_LOC_ON_STACK
> 4 DECLARE_DPM_WATCHDOG_ON_STACK
> 3 HISI_SAS_DECLARE_RST_WORK_ON_STACK
> 3 CONFIG_ARCH_TASK_STRUCT_ON_STACK
> 1 PT_SIZE_ON_STACK
> 1 ALLOC_PT_GPREGS_ON_STACK
>
> So perhaps:
>
> (?:SKCIPHER_REQUEST|SHASH_DESC|AHASH_REQUEST)_ON_STACK\s*\(
>
Yes, it's better.
I'll send a v2.
Thanks,
Gilad
--
Gilad Ben-Yossef
Chief Coffee Drinker
"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
-- Jean-Baptiste Queru
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-08 8:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-27 7:55 [PATCH] checkpatch: add *_ON_STACK to $declaration_macros Gilad Ben-Yossef
2017-12-20 9:41 ` Joe Perches
2018-01-08 8:22 ` Gilad Ben-Yossef
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.