android_kernel_xiaomi_sm8350/arch/blackfin
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
..
boot Blackfin: stick the CPU name into boot image name 2009-06-22 21:16:03 -04:00
configs Blackfin: update defconfigs 2009-06-22 21:16:01 -04:00
include/asm Blackfin: drop per-cpu loops_per_jiffy tracking 2009-07-16 01:52:44 -04:00
kernel Blackfin: add CPLB entries for Core B on-chip L1 SRAM regions 2009-07-16 01:52:51 -04:00
lib Blackfin: fix miscompilation in lshrdi3 2009-07-16 01:52:23 -04:00
mach-bf518 Blackfin: fix incomplete renaming of the bfin-twi-lcd driver 2009-07-16 01:52:32 -04:00
mach-bf527 Blackfin: fix incomplete renaming of the bfin-twi-lcd driver 2009-07-16 01:52:32 -04:00
mach-bf533 Blackfin: fix incomplete renaming of the bfin-twi-lcd driver 2009-07-16 01:52:32 -04:00
mach-bf537 Blackfin: bf537-stamp: fix irq decl for AD7142 2009-07-16 01:52:40 -04:00
mach-bf538 Blackfin: fix wrong CTS inversion 2009-07-16 01:52:30 -04:00
mach-bf548 Blackfin: fix incomplete renaming of the bfin-twi-lcd driver 2009-07-16 01:52:32 -04:00
mach-bf561 Blackfin: fix wrong CTS inversion 2009-07-16 01:52:30 -04:00
mach-common arch/blackfin: Add kmalloc NULL tests 2009-07-16 01:52:54 -04:00
mm Blackfin: decouple unrelated cache settings to get exact behavior 2009-06-22 21:15:59 -04:00
oprofile Blackfin arch: remove hardware PM code, oprofile not use it 2009-01-07 23:14:39 +08:00
Kconfig Blackfin: fix GPTMR0_CLOCKSOURCE dependency on BFIN_GPTIMERS 2009-06-22 21:16:15 -04:00
Kconfig.debug Blackfin: make deferred hardware errors more exact 2009-06-12 06:11:44 -04:00
Makefile Blackfin: add support for bzip2/lzma compressed kernel images 2009-06-13 07:20:13 -04:00