Messages in this thread | | | Date | Thu, 26 Jul 2018 13:38:29 -0700 | From | Andrew Morton <> | Subject | Re: [RFC PATCH] checkpatch: check for function calls with struct or union on stack |
| |
On Thu, 26 Jul 2018 13:05:29 -0700 Joe Perches <joe@perches.com> wrote:
> On Thu, 2018-07-26 at 12:28 -0700, Andrew Morton wrote: > > On Thu, 26 Jul 2018 12:25:33 -0700 Andrew Morton <akpm@linux-foundation.org> 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. > > RFC, No worries, I'll change it if it's OK. > > I'm testing it right now against the last 5000 commits > (which takes awhile here) via > > $ git log --no-merges --format=oneline -5000 | \ > cut -f1 -d" " | \ > while read commit ; do \ > echo $commit; \ > ./scripts/checkpatch.pl --git $commit --types=aggregate_on_stack --quiet --no-summary ; \ > done > > It doesn't seem noisy at all, but maybe there are a few > known structs like "struct timespec64" that could be > excluded. > > The only real hits so far are: > > commit f2fb56afba11426ee5c9603b28a9827c530909c0 > WARNING: Unusual use of 'struct msm_display_topology' on stack > #28374: FILE: drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c:149: > +enum dpu_rm_topology_name > +dpu_rm_get_topology_name(struct msm_display_topology topology) > +{
hm. 12 bytes. I don't know if this would be more efficient than using const struct msm_display_topology*.
> and > > 33477d84c26bbfa626da2c032e567a90dd70a528 > WARNING: Unusual use of 'struct cppc_perf_fb_ctrs' on stack > #45: FILE: drivers/cpufreq/cppc_cpufreq.c:307: > +static int cppc_get_rate_from_fbctrs(struct cppc_cpudata *cpu, > + struct cppc_perf_fb_ctrs fb_ctrs_t0, > + struct cppc_perf_fb_ctrs fb_ctrs_t1) > +{
Two 32-byte structures? That seems excessive.
Yes, a warning which sends developers back for a bit more thinnking sounds useful.
| |