[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8d9aa953d1e760b35bd4ef6c689dfb777c8a6a0.camel@perches.com>
Date: Sat, 28 Jul 2018 10:20:44 -0700
From: Joe Perches <joe@...ches.com>
To: Julia Lawall <julia.lawall@...6.fr>
Cc: David Laight <David.Laight@...LAB.COM>,
'Andrew Morton' <akpm@...ux-foundation.org>,
Andy Whitcroft <apw@...onical.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] checkpatch: check for function calls with struct or
union on stack
(unintentionally sent partial reply, better now)
On Sat, 2018-07-28 at 08:25 +0200, Julia Lawall wrote:
> On Fri, 27 Jul 2018, Joe Perches wrote:
[]
> > It might make sense for this sort of check to be
> > added to coccinelle or maybe as a compiler warning
> > when the struct is larger than some size.
> >
> > Original thread for Julia:
> > https://lore.kernel.org/patchwork/patch/967890/
>
> Coccinelle doesn't directly know the size of the structure, but it can
> count the number of fields. Maybe a case with an update in the function
> body
Perhaps this might be the most useful to check.
> or at least 3 fields is worth reporting on?
Maybe, maybe not. For instance:
lib/vsprintf.c uses struct printf_spec which is
5 fields totaling 8 bytes and that fits nicely in
a single register on x86-64 so there are good
reasons why structs could be passed by value.
Maybe structs with arrays or other structs would
make more sense.
Powered by blists - more mailing lists