> On 29 June 2014 at 11:33 Joe Perches <[email protected]> wrote: > > > On Sun, 2014-06-29 at 11:21 +0200, Fabian Frederick wrote: > > On Fri, 27 Jun 2014 14:37:04 -0700 Joe Perches <[email protected]> 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.
Tested on rc3: 766 warnings against 976 with original version. No more warnings for things like: mm/huge_memory.c pages = kmalloc(sizeof(struct page *) * HPAGE_PMD_NR, GFP_KERNEL); net/ipv6/ip6_fib.c mp = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL); lib/sort.c a = kmalloc(1000 * sizeof(int), GFP_KERNEL); Looks good. Fabian > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

