RE: [RFC PATCH] checkpatch: check for function calls with struct or union on stack

From: David Laight
Date: Fri Jul 27 2018 - 06:03:21 EST


From: Andrew Morton
> Sent: 26 July 2018 20:28
> On Thu, 26 Jul 2018 12:25:33 -0700 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> > I'll give it a spin, see how noisy it is.
>
> Actually, I would prefer if the message, changelog and title
> used the term "passed by value". It's a more familiar term
> and it is possible for a passed-by-value aggregate to in fact
> be passed in registers.

You need to detect (and ignore) 'small' structures.
Quite a few ABI pass small structures by value in register(s)
or directly on the stack.

So it can make sense to encapsulate an integer value in a
structure in order to get strong typing.

It would, for instance, make sense to do that for user addresses.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)