diff options
author | Julia Lawall <julia@diku.dk> | 2009-07-14 03:15:19 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-07-16 01:52:54 -0400 |
commit | 994e9a2e01f47f7ce24dec7edc45d70401468370 (patch) | |
tree | 897d3dbae7e2ec383e02ae6a8dfd9de2cb8ba2d8 /lib/debug_locks.c | |
parent | 5bc6e3cfe6db5f33c60f042a9ba203431f334756 (diff) |
arch/blackfin: Add kmalloc NULL tests
Check that the result of kmalloc is not NULL before passing it to other
functions.
In the first two cases, the new code returns -ENOMEM, which seems
compatible with what is done for similar functions for other architectures.
In the last two cases, the new code fails silently, ie just returns,
because the function has void return type.
The semantic match that finds this problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <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: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'lib/debug_locks.c')
0 files changed, 0 insertions, 0 deletions