linux/drivers
Julia Lawall 253d3b139a Staging: go7007: 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,l;
position p1,p2;
expression *ptr != NULL;
@@

(
if ((x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...)) == NULL) S
|
x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
)
<... when != x
     when != if (...) { <+...x...+> }
x->f = E
...>
(
 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: Greg Kroah-Hartman <gregkh@suse.de>
2009-04-03 14:53:27 -07:00
..
accessibility
acpi Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2009-04-01 09:47:12 -07:00
amba
ata
atm
auxdisplay auxdisplay: remove PARPORT dependency 2009-04-01 08:59:17 -07:00
base Merge git://git.infradead.org/iommu-2.6 2009-04-03 10:36:57 -07:00
block Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/linux-hdreg-h-cleanup 2009-04-03 09:02:32 -07:00
bluetooth
cdrom
char Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2009-04-03 09:45:53 -07:00
clocksource
connector
cpufreq
cpuidle
crypto Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2009-04-03 09:45:53 -07:00
dca
dio
dma
edac edac: AMD8111 driver Kconfig & Makefile 2009-04-02 19:05:04 -07:00
eisa
firewire
firmware dmi: Let dmi_walk() users pass private data 2009-03-30 21:46:44 +02:00
gpio gpio: gpio_{request,free}() now required (feature removal) 2009-04-02 19:04:51 -07:00
gpu drm/radeon: load the right microcode on rs780 2009-04-03 10:31:23 +10:00
hid
hwmon lis3: SPI transport layer 2009-04-01 08:59:22 -07:00
i2c Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6 2009-03-30 17:54:32 -07:00
ide ide-floppy: do not complete rq's prematurely 2009-03-31 20:15:34 +02:00
idle
ieee1394
infiniband
input workqueue: add to_delayed_work() helper function 2009-04-02 19:04:50 -07:00
isdn proc tty: remove struct tty_operations::read_proc 2009-04-01 08:59:10 -07:00
leds
lguest lguest: use bool instead of int 2009-03-30 21:55:25 +10:30
macintosh
mca
md Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm 2009-04-03 10:02:45 -07:00
media proc 2/2: remove struct proc_dir_entry::owner 2009-03-31 01:14:44 +04:00
memstick
message proc 2/2: remove struct proc_dir_entry::owner 2009-03-31 01:14:44 +04:00
mfd twl4030-regulator: expose VPLL2 2009-03-31 09:56:28 +01:00
misc xpc_sn2: fix max() warning about pointers of different types 2009-04-02 19:05:07 -07:00
mmc Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6 2009-04-03 10:39:20 -07:00
mtd [ARM] fix build-breaking 7a192ec commit 2009-04-02 23:23:43 +01:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2009-04-02 21:05:30 -07:00
nubus
of powerpc: add mmc-spi-slot bindings 2009-04-01 08:59:23 -07:00
oprofile oprofile: Thou shalt not call __exit functions from __init functions 2009-03-30 22:05:18 +10:30
parisc parisc: drivers: fix warnings 2009-04-02 00:40:41 +00:00
parport parport: netmos 9845 & 9855 1P4S fixes 2009-04-02 19:05:04 -07:00
pci Merge git://git.infradead.org/iommu-2.6 2009-04-03 10:36:57 -07:00
pcmcia [ARM] 5442/1: pxa/cm-x255: fix reverse RDY gpios in PCMCIA driver 2009-04-02 11:02:32 +01:00
platform Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6 2009-03-30 17:54:32 -07:00
pnp pnpbios: propagate kthread_run() error 2009-04-02 19:04:52 -07:00
power
ps3
rapidio
regulator regulator: twl4030 VAUX3 supports 3.0V 2009-03-31 11:29:54 +01:00
rtc Merge git://git.kernel.org/pub/scm/linux/kernel/git/kyle/rtc-parisc 2009-04-03 09:51:35 -07:00
s390 workqueue: add to_delayed_work() helper function 2009-04-02 19:04:50 -07:00
sbus
scsi proc 2/2: remove struct proc_dir_entry::owner 2009-03-31 01:14:44 +04:00
serial Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu 2009-04-03 09:44:58 -07:00
sh maple: fix Error in kernel-doc notation 2009-03-29 08:12:39 -07:00
sn
spi spi-gpio: allow operation without CS signal 2009-04-02 19:04:51 -07:00
ssb
staging Staging: go7007: introduce missing kfree 2009-04-03 14:53:27 -07:00
tc
telephony
thermal
uio
usb Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/linux-hdreg-h-cleanup 2009-04-03 09:02:32 -07:00
uwb
video fb: nvidiafb recognizes geforcego 7300 chip as mobile 2009-04-02 19:04:48 -07:00
virtio virtio: more neatening of virtio_ring macros. 2009-03-30 21:55:23 +10:30
w1 w1: coding style cleanups in w1_io.c 2009-04-02 19:05:04 -07:00
watchdog Merge branch 'hwmon-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6 2009-03-30 17:54:32 -07:00
xen PM: Rework handling of interrupts during suspend-resume 2009-03-30 21:46:54 +02:00
zorro
Kconfig
Makefile