]> 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>
Thu, 11 Aug 2011 14:43:16 +0000 (16:43 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 11 Aug 2011 14:43:31 +0000 (16:43 +0200)
commit411d1563d61b5db757e2ea5094d9edeee9cf5783
tree819d474b15e616932bc408a65228c3e66d220ec4
parentfb8b461555cd569bde2147de5a155a4c68fd5b94
[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