linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] MACRO_ARG_REUSE in checkpatch.pl is confused about * in typeof
@ 2018-04-01  5:04 rao.shoaib
  0 siblings, 0 replies; only message in thread
From: rao.shoaib @ 2018-04-01  5:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: paulmck, joe, willy, brouer, linux-mm, Rao Shoaib

From: Rao Shoaib <rao.shoaib@oracle.com>

Example:

CHECK: Macro argument reuse 'ptr' - possible side-effects?
+#define kfree_rcu(ptr, rcu_name)       \
+       do {                            \
+               unsigned long __off = offsetof(typeof(*(ptr)), rcu_name); \
+               struct rcu_head *__rptr = (void *)ptr + __off; \
+               __kfree_rcu(__rptr, __off); \
+       } while (0)

Fix supplied by Joe Perches.

Signed-off-by: Rao Shoaib <rao.shoaib@oracle.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 3d40403..def6bb2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -4998,7 +4998,7 @@ sub process {
 			        next if ($arg =~ /\.\.\./);
 			        next if ($arg =~ /^type$/i);
 				my $tmp_stmt = $define_stmt;
-				$tmp_stmt =~ s/\b(typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g;
+				$tmp_stmt =~ s/\b(?:typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*(?:\s*\*\s*)*\s*\(*\s*$arg\s*\)*\b//g;
 				$tmp_stmt =~ s/\#+\s*$arg\b//g;
 				$tmp_stmt =~ s/\b$arg\s*\#\#//g;
 				my $use_cnt = $tmp_stmt =~ s/\b$arg\b//g;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-01  5:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-01  5:04 [PATCH 1/1] MACRO_ARG_REUSE in checkpatch.pl is confused about * in typeof rao.shoaib

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).