]> git.karo-electronics.de Git - karo-tx-linux.git/commit
[S390] drivers/s390/block/dasd_ioctl.c: add missing kfree
authorJulia Lawall <julia@diku.dk>
Fri, 19 Aug 2011 07:10:18 +0000 (09:10 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 19 Aug 2011 07:10:27 +0000 (09:10 +0200)
commitad21490fa2b0f3fe4ca658085baaa3e80e234f9b
tree7aafa3805d0ec0e522b3e463a4b603cd532fd9bc
parent2ddee10eb8a0a728cb34cc3af52ad65ca3256496
[S390] drivers/s390/block/dasd_ioctl.c: add missing kfree

Data is only used to temporarily hold information to be copied to the user
level, so it should be freed before leaving the function.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@exists@
local idexpression x;
statement S,S1;
expression E;
identifier fl;
expression *ptr != NULL;
@@

x = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...kfree(x)...+> }
     when any
     when != true x == NULL
x->fl
...>
(
if (x == NULL) S1
|
if (...) { ... when != x
               when forall
(
 return \(0\|<+...x...+>\|ptr\);
|
* return ...;
)
}
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/block/dasd_ioctl.c