linux/drivers
Julia Lawall b3b7f0550f crypto: caam - 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>
Acked-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2011-04-08 20:39:23 +08:00
..
accessibility
acpi Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2011-03-25 21:01:43 -07:00
amba
ata Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2011-03-18 06:31:43 -07:00
atm Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-03-18 10:37:40 -07:00
auxdisplay
base Introduce ARCH_NO_SYSDEV_OPS config option (v2) 2011-03-23 22:16:41 +01:00
block Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block 2011-03-24 10:16:26 -07:00
bluetooth Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-03-18 10:37:40 -07:00
cdrom
char drivers/char/mem.c: clean up the code 2011-03-23 19:46:40 -07:00
clk
clocksource
connector
cpufreq cpufreq: Use syscore_ops for boot CPU suspend/resume (v2) 2011-03-23 22:16:32 +01:00
cpuidle
crypto crypto: caam - introduce missing kfree 2011-04-08 20:39:23 +08:00
dca drivers/dca/dca-core.c: use list_move() instead of list_del()/list_add() combination 2011-03-22 17:44:12 -07:00
dio
dma mfd: mfd_cell is now implicitly available to timberdale drivers 2011-03-23 10:41:52 +01:00
edac Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2011-03-18 10:37:40 -07:00
eisa
firewire Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6 2011-03-21 10:05:22 -07:00
firmware sigma-firmware: loader for Analog Devices' SigmaStudio 2011-03-22 17:44:15 -07:00
gpio Merge branch 'irq-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2011-03-25 20:24:05 -07:00
gpu Merge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6 2011-03-24 17:27:20 -07:00
hid backlight: add backlight type 2011-03-22 17:43:59 -07:00
hwmon jz4740: silence warnings related to mfd_get_cell changes 2011-03-23 10:42:02 +01:00
hwspinlock
i2c mfd: mfd_cell is now implicitly available to timberdale drivers 2011-03-23 10:41:52 +01:00
ide Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block 2011-03-24 10:16:26 -07:00
idle
ieee802154 ieee802154: change to new flag variable 2011-03-17 14:05:34 +01:00
infiniband Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband 2011-03-25 21:06:37 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2011-03-25 20:50:12 -07:00
isdn Merge branch 'trivial' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6 2011-03-20 18:14:55 -07:00
leds Merge git://git.infradead.org/battery-2.6 2011-03-25 21:00:29 -07:00
lguest
macintosh backlight: add backlight type 2011-03-22 17:43:59 -07:00
mca
md Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm 2011-03-25 20:51:44 -07:00
media [media] rc: update for bitop name changes 2011-03-24 18:58:55 -07:00
memstick memstick: add driver for Ricoh R5C592 card reader 2011-03-25 17:45:16 -07:00
message Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block 2011-03-24 10:16:26 -07:00
mfd Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 2011-03-24 09:50:13 -07:00
misc Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb 2011-03-25 21:04:56 -07:00
mmc Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block 2011-03-24 10:16:26 -07:00
mtd Merge branch 'for-linus' of git://git.infradead.org/ubi-2.6 2011-03-24 08:22:34 -07:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6 2011-03-25 21:02:22 -07:00
nfc
nubus
of of/flattree: minor cleanups 2011-03-23 14:55:56 -06:00
oprofile
parisc
parport
pci Merge branch 'syscore' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6 2011-03-25 21:07:59 -07:00
pcmcia
platform backlight: add backlight type 2011-03-22 17:43:59 -07:00
pnp pnp: only assign IORESOURCE_DMA if CONFIG_ISA_DMA_API is enabled 2011-03-22 17:44:16 -07:00
power Merge git://git.infradead.org/battery-2.6 2011-03-25 21:00:29 -07:00
pps pps: remove unreachable code 2011-03-22 17:44:17 -07:00
ps3
rapidio rapidio: fix potential null deref on failure path 2011-03-23 19:46:44 -07:00
regulator regulator: Add a subdriver for TI TPS6105x regulator portions v2 2011-03-23 10:42:09 +01:00
rtc rtc: add real-time clock driver for NVIDIA Tegra 2011-03-22 17:44:16 -07:00
s390 Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6 2011-03-25 17:47:04 -07:00
sbus
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2011-03-25 21:06:13 -07:00
sfi
sh sh: Use struct syscore_ops instead of sysdevs 2011-03-23 18:57:37 +09:00
sn
spi Merge branch 'devicetree/merge' of git://git.secretlab.ca/git/linux-2.6 2011-03-24 09:30:20 -07:00
ssb
staging Merge branch 'for-2.6.39/core' of git://git.kernel.dk/linux-2.6-block 2011-03-24 10:16:26 -07:00
target Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6 2011-03-25 21:06:13 -07:00
tc
telephony
thermal
tty Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb 2011-03-25 21:04:56 -07:00
uio
usb Merge branch 'usb-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2011-03-24 10:02:55 -07:00
uwb
vhost
video Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 2011-03-24 09:50:13 -07:00
virtio
vlynq
w1 w1: Silence ds1wm warnings related to mfd_get_cell changes 2011-03-23 10:42:02 +01:00
watchdog rdc321x-southbridge: Use mfd_data instead of driver_data 2011-03-23 10:41:57 +01:00
xen Merge branch 'stable/xen.pm.bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen 2011-03-17 18:37:42 -07:00
zorro
Kconfig
Makefile