Re: add memset checks to checkpatch.pl

From: Dave Jones
Date: Wed Aug 18 2010 - 18:17:33 EST


On Wed, Aug 18, 2010 at 02:57:59PM -0700, Joe Perches wrote:
> > I'm all for improving my shoddy perl where possible, but this doesn't seem to actually
> > catch any of the test cases I wrote. (it's also missing a } )
>
> I intend never to be a perl monk.
>
> I notice the missing { before the elsif after I sent it.
> Oh well.
>
> I just typed it in the emailer, so it's not tested at all.
> Also it's missing a $ after 1 in the second $memset_size test.

still didn't catch anything for me.

> What are your test cases anyway?

memset(foo, 0, 10);
memset(foo, 10, 0);
memset(foo, 1, 10);
memset(foo, 10, 1);

> Likely $Lval isn't matching things like
> sizeof(*foo) so this isn't checked:
>
> memset(foo, bar, sizeof(*foo));

I chose to just ignore any non integer arguments to keep things simple.

Dave

--
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/