aha/arch/m68k/mm
Julia Lawall 79aa79bac9 arch/m68k/mm/kmap.c: 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: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-14 10:23:27 -07:00
..
cache.c [PATCH] m68k: move cache functions into separate file 2005-09-05 00:06:19 -07:00
fault.c pid namespaces: define is_global_init() and is_container_init() 2007-10-19 11:53:37 -07:00
hwtest.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
init.c m68k: use generic show_mem() 2008-07-26 12:00:11 -07:00
kmap.c arch/m68k/mm/kmap.c: introduce missing kfree 2008-10-14 10:23:27 -07:00
Makefile [PATCH] m68k: move cache functions into separate file 2005-09-05 00:06:19 -07:00
memory.c m68k: discontinuous memory support 2007-05-31 07:58:14 -07:00
motorola.c mm: drop unneeded pgdat argument from free_area_init_node() 2008-07-24 10:47:16 -07:00
sun3kmap.c m68k: missing exports 2007-07-20 08:24:49 -07:00
sun3mmu.c mm: drop unneeded pgdat argument from free_area_init_node() 2008-07-24 10:47:16 -07:00