kernel-ark/arch/blackfin/mach-common
Julia Lawall 994e9a2e01 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>
2009-07-16 01:52:54 -04:00
..
arch_checks.c Blackfin: decouple unrelated cache settings to get exact behavior 2009-06-22 21:15:59 -04:00
cache-c.c Blackfin: add blackfin_invalidate_entire_icache for SMP systems 2009-06-13 07:20:07 -04:00
cache.S Blackfin: simplify the do_flush macro 2009-06-12 06:03:48 -04:00
clocks-init.c Blackfin: add note about anomaly 05000242 being worked around 2009-06-12 06:11:42 -04:00
cpufreq.c Blackfin: decouple unrelated cache settings to get exact behavior 2009-06-22 21:15:59 -04:00
dpmc_modes.S Blackfin arch: fix bug - On bf548-ezkit, ethernet fails to work after wakeup from "mem" 2009-03-05 18:41:24 +08:00
dpmc.c [Blackfin] arch: Functional power management support: Add CPU and platform voltage scaling support 2008-05-07 11:41:26 +08:00
entry.S Blackfin: cleanup code a bit with comments and defines 2009-07-16 01:39:39 -04:00
head.S Blackfin: fix command line corruption with DEBUG_DOUBLEFAULT 2009-06-12 06:11:52 -04:00
interrupt.S Blackfin: make deferred hardware errors more exact 2009-06-12 06:11:44 -04:00
ints-priority.c Blackfin: allow CONFIG_TICKSOURCE_GPTMR0 with interrupt pipeline 2009-06-22 21:15:54 -04:00
irqpanic.c Blackfin: only build irqpanic.c when needed 2009-06-18 21:40:49 -04:00
lock.S Blackfin arch: rename cache_lock() to bfin_cache_lock() 2008-11-18 17:48:22 +08:00
Makefile Blackfin: only build irqpanic.c when needed 2009-06-18 21:40:49 -04:00
pm.c Blackfin: decouple unrelated cache settings to get exact behavior 2009-06-22 21:15:59 -04:00
smp.c arch/blackfin: Add kmalloc NULL tests 2009-07-16 01:52:54 -04:00