Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 92d2bfb5a363004a8a399eefe5c79f14 > files > 165

coccinelle-examples-1.0.0-0.rc4.2.fc16.i686.rpm

// - if(copy_from_user(&x, arg))   does not work. 
// the if-isomorphism does not work :(

@@ 
type T; 
identifier x, fld; 
function ioctl; // should be caracterised by another rule
@@


 ioctl(..., void *arg, ...) {
 <...
- T x;
+ T *x = arg;
 ...
- if(copy_from_user(&x, arg)!=0) 
- { ... return ...; } 
 <...
(
- x.fld
+ x->fld
| 
- &x
+ x
)
 ...>
- if(copy_to_user(arg, &x))
- { ... return ...; }
 ...>
 }