Messages in this thread Patch in this message | | | Subject | Re: [PATCH 02/11] checkpatch: check for common memset parameter issues against statments | From | Joe Perches <> | Date | Mon, 28 Nov 2011 16:32:53 -0800 |
| |
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) {
| |