lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20121106120027.94648924.akpm@linux-foundation.org>
Date:	Tue, 6 Nov 2012 12:00:27 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Joe Perches <joe@...ches.com>
Cc:	Andy Whitcroft <apw@...onical.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] checkpatch: Add a --strict test for macro argument
 reuse

On Tue, 06 Nov 2012 02:35:39 -0800
Joe Perches <joe@...ches.com> wrote:

> Add a test for reuse of macro arguments to highlight
> any possible side-effects from this reuse.
> 
> Avoid this check on token name pasting and when the
> argument is used in a typeof or a __builtin.

Does this mean that if I do

	#define foo(a) bar(a, a)

that checkpatch will not generate a warning unless I give it
"--strict"?  If so: whaaah!  I want that warning to come out by
default.

Not being totally lazy, I tried it myself but my perl v5.10.1 had
conniptions over this patch:

akpm:/usr/src/25> perl scripts/checkpatch.pl -f a.c
Illegal character in prototype for main::CHECK : "MACRO_ARG_REUSE","Macroargumentreuse'$arg'-possibleside-effects?\n"."$herectx" at scripts/checkpatch.pl line 3039.
syntax error at scripts/checkpatch.pl line 3039, near ""Macro argument reuse '$arg' - possible side-effects?\n" . "$herectx")"
  (Might be a runaway multi-line () string starting on line 3038)
syntax error at scripts/checkpatch.pl line 3045, near "} else"
Global symbol "$herecurr" requires explicit package name at scripts/checkpatch.pl line 3049.
syntax error at scripts/checkpatch.pl line 3051, near "}"
Global symbol "$realfile" requires explicit package name at scripts/checkpatch.pl line 3057.
Global symbol "$line" requires explicit package name at scripts/checkpatch.pl line 3058.
Global symbol "$realcnt" requires explicit package name at scripts/checkpatch.pl line 3060.
Global symbol "$realcnt" requires explicit package name at scripts/checkpatch.pl line 3064.
Global symbol "$here" requires explicit package name at scripts/checkpatch.pl line 3075.
syntax error at scripts/checkpatch.pl line 3091, near "}"
scripts/checkpatch.pl has too many errors.

<looks at the patch>

<fixes it>

--- a/scripts/checkpatch.pl~checkpatch-add-a-strict-test-for-macro-argument-reuse-fix
+++ a/scripts/checkpatch.pl
@@ -3035,7 +3035,7 @@ sub process {
 				$tmp =~ s/\b$arg\s*\#\#//g;
 				my $use_cnt = $tmp =~ s/\b$arg\b//g;
 				if ($use_cnt > 1) {
-					CHECK("MACRO_ARG_REUSE",
+					ERROR("MACRO_ARG_REUSE",
 					      "Macro argument reuse '$arg' - possible side-effects?\n" . "$herectx");
 				}
 			}
_


Ah, good:

akpm:/usr/src/25> perl scripts/checkpatch.pl -f a.c
ERROR: Macro argument reuse 'a' - possible side-effects?
#1: FILE: a.c:1:
+#define foo(a) bar(a, a)

total: 1 errors, 0 warnings, 1 lines checked

a.c has style problems, please review.

If any of these errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.


So what's all this stuff about "--strict" in the patch title?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ