lkml.org 
[lkml]   [2018]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] checkpatch: check for function calls with struct or union on stack
On Thu, 26 Jul 2018 11:27:50 -0700 Joe Perches <joe@perches.com> 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.

\
 
 \ /
  Last update: 2018-07-26 21:25    [W:0.109 / U:0.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site