From: Julia Lawall Date: Tue, 14 Jul 2009 03:15:19 +0000 (+0000) Subject: arch/blackfin: Add kmalloc NULL tests X-Git-Tag: v2.6.31-rc4~22^2~1 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=994e9a2e01f47f7ce24dec7edc45d70401468370;p=pandora-kernel.git 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/) // @@ 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 ) // Signed-off-by: Julia Lawall Signed-off-by: Sonic Zhang Signed-off-by: Mike Frysinger --- Reading git-diff-tree failed