On Sat, 19 Jul 2014, Himangi Saraogi wrote:

> alloc_bootmem and related functions never return NULL and always return
> a zeroed region of memory.  Thus a BUG_ON the NULL test or memset after
> calls to these functions is unnecessary.
> 
> The following Coccinelle semantic patch was used for making the change:
> 
> @@
> expression E;
> statement S;
> @@
> 
> E = 
> \(alloc_bootmem\|alloc_bootmem_low\|alloc_bootmem_pages\|alloc_bootmem_low_pages\)(...)
> ... when != E
> - BUG_ON (E == NULL);
> 
> @@
> expression E,E1;
> @@
> 
> E = 
> \(alloc_bootmem\|alloc_bootmem_low\|alloc_bootmem_pages\|alloc_bootmem_low_pages\)(...)
> ... when != E
> - memset(E,0,E1);
> 
> Signed-off-by: Himangi Saraogi <himangi...@gmail.com>
> Acked-by: Julia Lawall <julia.law...@lip6.fr>

Acked-by: David Rientjes <rient...@google.com>

Many callers of alloc_bootmem() do not check for the return value because 
of this, there's no fallback available at this part in bootstrap so 
there's nothing else that can be done.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to