linux/drivers/net/wan
Julia Lawall 966a5d1b85 drivers/net/wan: introduce missing kfree
Error handling code following a kmalloc should free the allocated data.

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@

x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...x...+> }
(
x->f1 = E
|
 (x->f1 == NULL || ...)
|
 f(...,x->f1,...)
)
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-09-11 12:54:30 -07:00
..
lmc wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
.gitignore
c101.c
cosa.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
cosa.h
cycx_drv.c
cycx_main.c
cycx_x25.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
dlci.c wan: dlci/sdla transmit return dehacking 2009-09-07 01:56:33 -07:00
dscc4.c WAN: dscc4: Fix warning pointing out a bug. 2009-09-03 21:34:39 -07:00
farsync.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
farsync.h
hd64570.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
hd64570.h
hd64572.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
hd64572.h
hdlc.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
hdlc_cisco.c
hdlc_fr.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
hdlc_ppp.c drivers/net/wan: introduce missing kfree 2009-09-11 12:54:30 -07:00
hdlc_raw.c
hdlc_raw_eth.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
hdlc_x25.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
hostess_sv11.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
ixp4xx_hss.c IXP42x HSS support for setting internal clock rate 2009-09-07 01:56:49 -07:00
Kconfig
lapbether.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
Makefile
n2.c
pc300-falc-lh.h
pc300.h
pc300_drv.c
pc300_tty.c
pc300too.c
pci200syn.c WAN: remove deprecated PCI_DEVICE_ID from PCI200SYN driver. 2009-09-07 01:56:45 -07:00
sbni.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
sbni.h
sdla.c wan: dlci/sdla transmit return dehacking 2009-09-07 01:56:33 -07:00
sealevel.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
wanxl.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
wanxl.h
wanxlfw.inc_shipped
wanxlfw.S
x25_asy.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
x25_asy.h
z85230.c wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00
z85230.h wan: convert drivers to netdev_tx_t 2009-09-01 01:13:28 -07:00