1
0
Fork 0
alistair23-linux/drivers/crypto
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
..
amcc dt/powerpc: Eliminate users of of_platform_{,un}register_driver 2011-02-28 01:36:39 -07:00
caam crypto: caam - introduce missing kfree 2011-04-08 20:39:23 +08:00
Kconfig crypto: caam - Add support for the Freescale SEC4/CAAM 2011-03-27 10:45:16 +08:00
Makefile crypto: caam - Add support for the Freescale SEC4/CAAM 2011-03-27 10:45:16 +08:00
geode-aes.c crypto: geode_aes - Convert pci_table entries to PCI_VDEVICE (if PCI_ANY_ID is used) 2010-07-19 13:50:21 +08:00
geode-aes.h [CRYPTO] geode: do not copy the IV too often 2008-01-11 08:16:26 +11:00
hifn_795x.c replace nested max/min macros with {max,min}3 macro 2010-10-26 16:52:12 -07:00
ixp4xx_crypto.c IXP4xx: Fix ixp4xx_crypto little-endian operation. 2010-05-27 13:02:42 +02:00
mv_cesa.c crypto: mv_cesa - dont return PTR_ERR() of wrong pointer 2011-01-04 23:34:06 +11:00
mv_cesa.h crypto: mv_cesa - Add sha1 and hmac(sha1) async hash drivers 2010-04-13 16:50:49 +08:00
n2_asm.S crypto: n2 - Add Niagara2 crypto driver 2010-05-19 14:14:04 +10:00
n2_core.c dt/sparc: Eliminate users of of_platform_{,un}register_driver 2011-02-28 01:36:39 -07:00
n2_core.h crypto: n2 - Add Niagara2 crypto driver 2010-05-19 14:14:04 +10:00
omap-aes.c crypto: omap-aes - don't treat NULL clk as an error 2011-01-29 15:57:32 +11:00
omap-sham.c crypto: omap-sham - don't treat NULL clk as an error 2011-01-29 16:01:02 +11:00
padlock-aes.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2011-01-13 10:25:58 -08:00
padlock-sha.c crypto: padlock - Add SHA-1/256 module for VIA Nano 2011-03-27 10:45:18 +08:00
picoxcell_crypto.c crypto: picoxcell - fix possible status FIFO overflow 2011-03-27 10:48:29 +08:00
picoxcell_crypto_regs.h crypto: picoxcell - add support for the picoxcell crypto engines 2011-02-21 22:42:40 +11:00
talitos.c dt: Eliminate of_platform_{,un}register_driver 2011-02-28 13:22:46 -07:00
talitos.h crypto: talitos - add support for sha224 2010-05-19 19:21:53 +10:00