linux/drivers/staging
Julia Lawall 542f491542 Staging: iio: introduce missing kfree
Error handling code following a kmalloc or kzalloc 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>
2009-09-15 12:02:34 -07:00
..
agnx Staging: agnx: remove flush_workqueue() 2009-09-15 12:02:29 -07:00
altpciechdma Staging: altpciechdma: 64bit type warning fix 2009-09-15 12:02:26 -07:00
android staging: Make some structures static 2009-09-15 12:02:24 -07:00
asus_oled Staging: asus_oled: Cleaned up checkpatch issues. 2009-09-15 12:02:33 -07:00
at76_usb Staging: at76_usb: replace mac2str() with %pM 2009-09-15 12:01:37 -07:00
b3dfg Staging: b3dfg: Drop NULL test on list_entry result 2009-09-15 12:01:40 -07:00
comedi Staging: comedi: addi-data: NULL dereference of amcc in v_pci_card_list_init() 2009-09-15 12:02:34 -07:00
cowloop Staging: cowloop: remove kernel version checks 2009-09-15 12:02:33 -07:00
cpc-usb Staging: cpc-usb: add one todo entry 2009-09-15 12:02:05 -07:00
dream Staging: dream: introduce missing kfree 2009-09-15 12:02:34 -07:00
dst Staging: dst: correct error-handling code 2009-09-15 12:02:06 -07:00
echo Staging: echo: coding style cleanups 2009-09-15 12:02:16 -07:00
et131x Staging: et131x: kill off the TXDMA CSR type 2009-09-15 12:02:29 -07:00
frontier
go7007
heci
hv Staging: hv: update the TODO file 2009-09-15 12:02:04 -07:00
iio Staging: iio: introduce missing kfree 2009-09-15 12:02:34 -07:00
line6 Staging: ARRAY_SIZE changes 2009-09-15 12:02:06 -07:00
me4000
meilhaus Staging: ARRAY_SIZE changes 2009-09-15 12:02:06 -07:00
mimio
octeon
otus staging: Make some structures static 2009-09-15 12:02:24 -07:00
p9auth
panel Staging: panel: Add support for TI CLCD interface 2009-09-15 12:02:29 -07:00
phison
poch
pohmelfs Staging: pohmelfs: sync with the development tree 2009-09-15 12:02:30 -07:00
quatech_usb2
rar Staging: rar/sep: Don't use random VENDOR_ID macros but the proper names 2009-09-15 12:02:12 -07:00
rspiusb Staging: rspiusb: Check usb_buffer_map_sg() retval 2009-09-15 12:02:29 -07:00
rt2860 Staging: rt2860/rt2870/rt3070/rt3090: fix compiler warning on x86_64 2009-09-15 12:02:34 -07:00
rt2870 Staging: rt2870: remove old firmware 2009-09-15 12:02:23 -07:00
rt3070 Staging: remove no longer needed rt3070 driver 2009-09-15 12:02:23 -07:00
rt3090 Staging: rt3090: enable NATIVE_WPA_SUPPLICANT_SUPPORT option 2009-09-15 12:02:34 -07:00
rtl8187se Staging: rtl8187se: Fix comment-out-typo 2009-09-15 12:02:17 -07:00
rtl8192e Staging: rtl8192e: Drop unnecessary NULL test 2009-09-15 12:02:33 -07:00
rtl8192su Staging: rtl8192su: add linux/vmalloc.h 2009-09-15 12:02:17 -07:00
sep Staging: sep: SEP driver build breaks with CONFIG_PCI=n 2009-09-15 12:02:15 -07:00
serqt_usb2 Staging: serqt_usb2: fix qt_open parameters 2009-09-15 12:02:06 -07:00
slicoss Staging: ARRAY_SIZE changes 2009-09-15 12:02:06 -07:00
stlc45xx
sxg Staging: ARRAY_SIZE changes 2009-09-15 12:02:06 -07:00
udlfb Staging: udlfb: fix printk format warning 2009-09-15 12:02:06 -07:00
usbip Staging: usb-ip: vhci_hdc:Fix the returned error value 2009-09-15 12:02:05 -07:00
vme Staging: vme: change to VME_BUS 2009-09-15 12:02:11 -07:00
vt6655 Staging: vt665x: fix built-in compiling 2009-09-15 12:02:34 -07:00
vt6656 Staging: vt665x: fix built-in compiling 2009-09-15 12:02:34 -07:00
winbond Staging: w35und: Remove some write-only struct members 2009-09-15 12:02:17 -07:00
wlan-ng Staging: wlan-ng: remove dependency on WIRELESS_EXT version 2009-09-15 12:01:37 -07:00
Kconfig Staging: add cowloop to the build 2009-09-15 12:02:33 -07:00
Makefile Staging: add cowloop to the build 2009-09-15 12:02:33 -07:00
staging.c