Re: [RFC PATCH] checkpatch: check for function calls with struct or union on stack
From: Andrew Morton
Date: Thu Jul 26 2018 - 15:25:37 EST
On Thu, 26 Jul 2018 11:27:50 -0700 Joe Perches <joe@xxxxxxxxxxx> wrote:
> I was cc'd on a patch where structs were used on stack instead
> of using pointers to the structs.
"passed by value" is a good term for this practice.
This can cause defects when
> the calling function modifies the stack struct instead of the
"called"
> calling function's struct.
>
> Possible patch below, but it may be overkill for the number of
> instances
> where this is actually an issue.
>
> Thoughts?
Seems worthwhile.
> There are what seems to be some false positives for a few of the
> .h files in include/linux/... where the false positives are for
> very small structs where the indirection via a pointer might be
> slower than than the stack use.
>
> For instance: (some duplicates removed)
I'll give it a spin, see how noisy it is.