Bluetooth: Add missing kmalloc NULL tests to Marvell driver
authorJulia Lawall <julia@diku.dk>
Thu, 6 Aug 2009 20:05:18 +0000 (22:05 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 22 Aug 2009 21:33:22 +0000 (14:33 -0700)
Check that the result of kmalloc is not NULL before dereferencing it.
The patch also replaces kmalloc + memset by kzalloc.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression *x;
identifier f;
constant char *C;
@@

x = \(kmalloc\|kcalloc\|kzalloc\)(...);
... when != x == NULL
    when != x != NULL
    when != (x || ...)
(
kfree(x)
|
f(...,C,...,x,...)
|
*f(...,x,...)
|
*x->f
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

No differences found