Sophie

Sophie

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

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

@ rule1 @
type T;
struct net_device *dev;
expression E;
@@

 dev = 
(
        alloc_netdev
| 
        alloc_etherdev
|
        alloc_fcdev
|
        alloc_fddidev
|
        alloc_hippi_dev
|
        alloc_trdev
|
        alloc_ltalkdev
|
        alloc_irdadev
| 
        alloc_etherdev_mq
)
   (sizeof(T), ...)

//sizeof(T) + E


@ rule1bis @
struct net_device *dev;
expression E;
@@

 dev->priv = E
//+ DANGERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR


@ rule2 depends on !rule1  @
struct net_device *dev;
@@

- netdev_priv(dev)
+ no_alloc_xxx


@ rule3 depends on rule1bis  @
struct net_device *dev;
@@

- netdev_priv(dev)
+ with_danger