linux/drivers
Julia Lawall 971370cc18 drivers/rtc: introduce missing kfree
Error handling code following a 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>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-09-23 07:39:45 -07:00
..
accessibility
acpi x86: Trivial whitespace cleanups 2009-09-20 20:18:57 +02:00
amba Merge branches 'arm', 'at91', 'bcmring', 'ep93xx', 'mach-types', 'misc' and 'w90x900' into devel 2009-09-12 12:01:34 +01:00
ata trivial: fix comment typo in drivers/ata/pata_hpt37x.c 2009-09-21 15:15:53 +02:00
atm
auxdisplay
base mm: oom analysis: add shmem vmstat 2009-09-22 07:17:27 -07:00
block seq_file: constify seq_operations 2009-09-23 07:39:29 -07:00
bluetooth pcmcia: dtl1_cs: fix pcmcia_loop_config logic 2009-09-15 10:17:16 -07:00
cdrom const: make block_device_operations const 2009-09-22 07:17:25 -07:00
char BUILD_BUG_ON(): fix it and a couple of bogus uses of it 2009-09-23 07:39:29 -07:00
clocksource
connector proc connector: add event for process becoming session leader 2009-09-23 07:39:29 -07:00
cpufreq Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq 2009-09-18 09:16:57 -07:00
cpuidle cpuidle: menu governor: reduce latency on exit 2009-09-22 07:17:45 -07:00
crypto
dca
dio
dma at_hdmac: Rework suspend_late()/resume_early() 2009-09-14 20:27:00 +02:00
edac trivial: fix typo "for for" in multiple files 2009-09-21 15:14:54 +02:00
eisa
firewire driver model: constify attribute groups 2009-09-15 09:50:47 -07:00
firmware mm: don't use alloc_bootmem_low() where not strictly needed 2009-09-22 07:17:38 -07:00
gpio spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
gpu Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid 2009-09-22 07:51:28 -07:00
hwmon spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
i2c [PATCH] i2c-imx: make bus available early 2009-09-19 23:36:56 +01:00
ide Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
idle
ieee1394
ieee802154
infiniband walk system ram range 2009-09-23 07:39:41 -07:00
input spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
isdn seq_file: constify seq_operations 2009-09-23 07:39:29 -07:00
leds spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
lguest trivial: fix typo "to to" in multiple files 2009-09-21 15:14:55 +02:00
macintosh trivial: remove unnecessary semicolons 2009-09-21 15:14:58 +02:00
mca
md Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
media Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
memstick const: make block_device_operations const 2009-09-22 07:17:25 -07:00
message Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
mfd spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
misc spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
mmc spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
mtd spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
net spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
nubus
of of: remove "stm,m25p40" alias 2009-09-23 07:39:43 -07:00
oprofile const: mark remaining super_operations const 2009-09-22 07:17:24 -07:00
parisc mm: replace various uses of num_physpages by totalram_pages 2009-09-22 07:17:38 -07:00
parport
pci Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6 2009-09-16 07:49:54 -07:00
pcmcia pcmcia: cleanup/fixup patch for sa1100_jornada_pcmcia driver 2009-09-22 07:17:42 -07:00
platform hp-wmi: Switch driver to dev_pm_ops 2009-09-14 20:26:59 +02:00
pnp pnp: add a shutdown method to pnp drivers 2009-09-22 07:17:49 -07:00
power
pps
ps3 powerpc/ps3: Workaround for flash memory I/O error 2009-09-11 11:28:00 +10:00
rapidio
regulator regulator: Voltage count for AB3100 2009-09-17 15:48:24 +02:00
rtc drivers/rtc: introduce missing kfree 2009-09-23 07:39:45 -07:00
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
sbus const: make block_device_operations const 2009-09-22 07:17:25 -07:00
scsi seq_file: constify seq_operations 2009-09-23 07:39:29 -07:00
serial spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
sh
sn
spi spi: handle TX-only/RX-only 2009-09-23 07:39:44 -07:00
ssb ssb/sdio: fix printk format warnings 2009-09-16 16:21:00 -04:00
staging spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
tc
telephony
thermal
uio Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6 2009-09-18 09:43:09 -07:00
usb Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
uwb trivial: remove unnecessary semicolons 2009-09-21 15:14:58 +02:00
video spi: prefix modalias with "spi:" 2009-09-23 07:39:43 -07:00
virtio
vlynq vlynq: includecheck fix: drivers/vlynq/vlynq.c 2009-09-23 07:39:30 -07:00
w1
watchdog [WATCHDOG] sizeof cleanup 2009-09-18 08:39:37 +00:00
xen Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2009-09-22 07:51:45 -07:00
zorro
Kconfig
Makefile