kernel-fxtec-pro1x/arch
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
..
alpha headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
arm sched: INIT_PREEMPT_COUNT 2009-07-10 14:24:05 -07:00
avr32 sched: INIT_PREEMPT_COUNT 2009-07-10 14:24:05 -07:00
blackfin arch/blackfin: Add kmalloc NULL tests 2009-07-16 01:52:54 -04:00
cris headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
frv sched: INIT_PREEMPT_COUNT 2009-07-10 14:24:05 -07:00
h8300 sched: INIT_PREEMPT_COUNT 2009-07-10 14:24:05 -07:00
ia64 headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
m32r headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
m68k sched: INIT_PREEMPT_COUNT 2009-07-10 14:24:05 -07:00
m68knommu Remove multiple KERN_ prefixes from printk formats 2009-07-08 10:30:03 -07:00
microblaze headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
mips headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
mn10300 mn10300: remove duplicated #include 2009-07-13 09:09:08 -07:00
parisc sched: INIT_PREEMPT_COUNT 2009-07-10 14:24:05 -07:00
powerpc headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
s390 headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
sh headers: smp_lock.h redux 2009-07-12 12:22:34 -07:00
sparc Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6 2009-07-13 10:24:08 -07:00
um sched: INIT_PREEMPT_COUNT 2009-07-10 14:24:05 -07:00
x86 x86: Fix warning in pvclock.c 2009-07-14 16:25:05 +02:00
xtensa sched: INIT_PREEMPT_COUNT 2009-07-10 14:24:05 -07:00
.gitignore
Kconfig gcov: add gcov profiling infrastructure 2009-06-18 13:03:57 -07:00