Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1721805

cocci: remove unnecessary casts of void * while avoiding casts with __user or __force ?

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject cocci: remove unnecessary casts of void * while avoiding casts with __user or __force ?
Date 2017-08-28 18:50 +0200
Message-ID <ujvoD-7Xb-35@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


A simple cocci script that removes unnecessary casts of
a void * will also remove casts with __force or __user

e.g.:

-       xemaclite_aligned_write(address_ptr, (u32 __force *) addr, ETH_ALEN);
+       xemaclite_aligned_write(address_ptr, addr, ETH_ALEN);

Is there a simple mechanism to avoid converting those?

$ cat void.cocci
@@
type T;
void *v;
expression e;
@@

-	e = (T *)v;
+	e = v;

@@
identifier f;
type T;
void *v;
@@

	f(...,
-	(T *)v,
+	v,
	...)

$

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

cocci: remove unnecessary casts of void * while avoiding casts with  __user or __force ? Joe Perches <joe@perches.com> - 2017-08-28 18:50 +0200
  Re: [Cocci] cocci: remove unnecessary casts of void * while avoiding  casts with __user or __force ? Julia Lawall <julia.lawall@lip6.fr> - 2017-08-29 07:30 +0200

csiph-web