linux/drivers
Julia Lawall 823d219f23 [SCSI] pm8001: 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;
expression E;
identifier f,f1;
position p1,p2;
@@

x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
<... when != x
     when != if (...) { <+...x...+> }
     when != (x) == NULL
     when != (x) != NULL
     when != (x) == 0
     when != (x) != 0
(
x->f1 = E
|
 (x->f1 == NULL || ...)
|
 f(...,x->f1,...)
)
...>
(
 return <+...x...+>;
|
 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>
Acked-by: jack wang <jack_wang@usish.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2010-08-06 12:06:08 -05:00
..
accessibility
acpi acpi ec_sys: Be more cautious about ec write access 2010-08-03 09:49:13 -04:00
amba ARM: AMBA: Add pclk support to AMBA bus infrastructure 2010-07-31 13:07:27 +01:00
ata
atm Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
auxdisplay
base Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
block Merge branch 'virtio' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus 2010-08-05 13:49:37 -07:00
bluetooth Bluetooth: Fix kfree() => kfree_skb() in hci_ath.c 2010-07-27 15:27:45 -07:00
cdrom
char Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 2010-08-05 16:02:01 -07:00
clocksource
connector
cpufreq [CPUFREQ] fix brace coding style issue. 2010-08-03 13:47:05 -04:00
cpuidle [CPUFREQ] x86 cpufreq: Make trace_power_frequency cpufreq driver independent 2010-08-03 13:47:05 -04:00
crypto Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
dca
dio
dma Merge branch 'master' into for-next 2010-08-04 15:14:38 +02:00
edac amd64_edac: Minor formatting fix 2010-08-04 11:16:01 +02:00
eisa
firewire
firmware [SCSI] iscsi boot: mv iscsi_boot_sysfs to drivers/scsi 2010-08-06 10:45:07 -05:00
gpio Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
gpu Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 2010-08-05 16:02:01 -07:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2010-08-04 15:23:49 -07:00
hwmon Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
i2c Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
ide
idle Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq 2010-08-04 11:13:36 -07:00
ieee1394
ieee802154
infiniband Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-08-04 15:31:02 -07:00
input Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
isdn Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-08-04 15:31:02 -07:00
leds
lguest
macintosh
mca
md
media Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-08-04 15:31:02 -07:00
memstick
message Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-08-04 15:31:02 -07:00
mfd
misc Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2010-08-04 15:15:15 -07:00
mmc Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
mtd Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
net Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
nubus
of of/platform: Register of_platform_drivers with an "of:" prefix 2010-08-01 01:44:18 -06:00
oprofile
parisc Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-08-04 15:31:02 -07:00
parport
pci
pcmcia Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus 2010-08-05 08:53:20 -07:00
platform ips driver: make it less chatty 2010-08-03 11:55:15 -04:00
pnp
power POWER: Add JZ4740 battery driver. 2010-08-05 13:26:20 +01:00
pps
ps3
rapidio
regulator regulator: tps6507x: allow driver to use DEFDCDC{2,3}_HIGH register 2010-07-28 15:09:26 +01:00
rtc Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus 2010-08-05 08:53:20 -07:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2010-08-04 15:15:15 -07:00
sbus Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
scsi [SCSI] pm8001: introduce missing kfree 2010-08-06 12:06:08 -05:00
serial Merge branch 'kms-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb 2010-08-05 16:00:44 -07:00
sfi
sh
sn
spi of/address: Clean up function declarations 2010-08-01 01:42:42 -06:00
ssb
staging Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-08-04 15:31:02 -07:00
tc
telephony
thermal
uio
usb Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
uwb
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2010-08-04 11:47:58 -07:00
video Merge branch 'kms-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb 2010-08-05 16:00:44 -07:00
virtio
vlynq
w1
watchdog Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-08-05 15:57:35 -07:00
xen Merge branch 'xen/xenbus' into upstream/xen 2010-08-04 14:49:24 -07:00
zorro
Kconfig
Makefile