linux/arch
Julia Lawall 7a626b66bb powerpc/ipic: 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>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2009-08-20 10:27:34 +10:00
..
alpha mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
arm ARM: 5673/1: U300 fix initsection compile warning 2009-08-15 15:36:52 +01:00
avr32 mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
blackfin blackfin: fix wrong CTS inversion 2009-07-20 16:38:44 -07:00
cris mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
frv mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
h8300 sched: INIT_PREEMPT_COUNT 2009-07-10 14:24:05 -07:00
ia64 arch/ia64/kernel/iosapic: missing test after ioremap() 2009-08-11 14:52:11 -07:00
m32r mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
m68k mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
m68knommu Remove multiple KERN_ prefixes from printk formats 2009-07-08 10:30:03 -07:00
microblaze Merge branch 'fixes-for-linus' of git://git.monstr.eu/linux-2.6-microblaze 2009-07-27 12:18:27 -07:00
mips Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus 2009-08-17 13:39:52 -07:00
mn10300 MN10300: includecheck fix: mn10300, pci.h 2009-08-10 08:54:27 -07:00
parisc parisc: Set correct bit in protection flags 2009-08-02 12:36:05 +02:00
powerpc powerpc/ipic: introduce missing kfree 2009-08-20 10:27:34 +10:00
s390 Merge branch 'kvm-updates/2.6.31' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2009-08-09 14:58:21 -07:00
sh sh: sh7724 ddr self-refresh changes 2009-08-15 12:58:50 +09:00
sparc percpu, sparc64: fix sparse possible cpu map handling 2009-08-14 13:20:53 +09:00
um mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
x86 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2009-08-18 19:41:05 -07:00
xtensa mm: Pass virtual address to [__]p{te,ud,md}_free_tlb() 2009-07-27 12:10:38 -07:00
.gitignore
Kconfig gcov: add gcov profiling infrastructure 2009-06-18 13:03:57 -07:00