mirror of
https://github.com/torvalds/linux.git
synced 2024-11-07 20:51:47 +00:00
c0d861afa5
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,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> Cc: Mike Rapoport <mike@compulab.co.il> Cc: Richard Purdie <rpurdie@linux.intel.com> Cc: Eric Miao <eric.miao@marvell.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> |
||
---|---|---|
.. | ||
atmel-pwm-bl.c | ||
backlight.c | ||
corgi_bl.c | ||
corgi_lcd.c | ||
cr_bllcd.c | ||
da903x.c | ||
hp680_bl.c | ||
ili9320.c | ||
ili9320.h | ||
kb3886_bl.c | ||
Kconfig | ||
lcd.c | ||
locomolcd.c | ||
ltv350qv.c | ||
ltv350qv.h | ||
Makefile | ||
mbp_nvidia_bl.c | ||
omap1_bl.c | ||
platform_lcd.c | ||
progear_bl.c | ||
pwm_bl.c | ||
tdo24m.c | ||
tosa_bl.c | ||
tosa_lcd.c | ||
vgg2432a4.c |