diff options
author | Julia Lawall <[email protected]> | 2009-09-22 16:47:39 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2009-09-23 07:39:56 -0700 |
commit | ff8147fe71246b81a48de5f37041b026b57d60ca (patch) | |
tree | 9ae6fb50b937d1b38a7d53a925d5fb9759db1cd4 /scripts/basic/docproc.c | |
parent | f7a595e98c3140f1271957aa742a6b84407620d4 (diff) |
drivers/video: add kmalloc NULL tests
Check that the result of kmalloc is not NULL before passing it to other
functions.
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>
[[email protected]: convert to kstrdup() as well]
Signed-off-by: Julia Lawall <[email protected]>
Cc: Ming Lei <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'scripts/basic/docproc.c')
0 files changed, 0 insertions, 0 deletions