Re: [PATCH 02/11] checkpatch: check for common memset parameterissues against statments

From: Joe Perches
Date: Mon Nov 28 2011 - 19:32:55 EST


On Mon, 2011-11-28 at 15:42 +0000, Andy Whitcroft wrote:
> Move the memset checks over to work against the statement. Also add
> checks for 0 and 1 used as lengths. Generally these indicate badly
> ordered parameters.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3111,6 +3111,28 @@ sub process {
> "Avoid line continuations in quoted strings\n" . $herecurr);
> }
>
> +# Check for misused memsets
> + if (defined $stat && $stat =~ /\bmemset\s*\((.*)\)/s) {

Perhaps this is better.
It allows close parenthesis in the memset.
eg: memset(foo, bar(baz), sizeof(foo));

if (defined $stat && $stat = /\bmemset\s*$match_balanced_parentheses/s) {


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