Re: [PATCH 1/1] scripts/checkpatch.pl: update kmalloc_array/kcalloc conversion warning

From: Joe Perches
Date: Sun Jun 29 2014 - 05:34:10 EST


On Sun, 2014-06-29 at 11:21 +0200, Fabian Frederick wrote:
> On Fri, 27 Jun 2014 14:37:04 -0700 Joe Perches <joe@xxxxxxxxxxx> wrote:
[]
> > I'm not sure of the value of this as I think at some point
> > if not already today, the compiler will optimize the multiply
> > away.
> >
> > But it's probably better to look at the non-sizeof variable
> > and emit the warning only when it's not $Constant or some
> > upper-case only macro #define like "\b[A-Z_]+\b" is used.
[]
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> > + }
> > + if ($r1 !~ /^sizeof\b/ && $r2 =~ /^sizeof\s*\S/ &&
> > + !($r1 =~ /^$Constant$/ || $r1 =~ /^[A-Z_]+$/)) {

This last test should be

/^[A-Z_][A-Z0-9_]*$/

to allow upper case macros with digits too

> Already tested ? If not I can do it and give you some feedback ...

Lightly. Test away.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/