[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1407211553190.29389@chino.kir.corp.google.com>
Date: Mon, 21 Jul 2014 15:56:48 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Himangi Saraogi <himangi774@...il.com>
cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
linux-kernel@...r.kernel.org, Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH] x86, olpc: Eliminate BUG_ON and memset after
alloc_bootmem
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 <himangi774@...il.com>
> Acked-by: Julia Lawall <julia.lawall@...6.fr>
Acked-by: David Rientjes <rientjes@...gle.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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists