* [PATCH 2.6.19-rc2] mm/slab.c: check kmalloc() return value.
@ 2006-10-22 20:37 Amit Choudhary
2006-10-22 21:16 ` Josef Sipek
2006-10-23 6:38 ` Pekka Enberg
0 siblings, 2 replies; 4+ messages in thread
From: Amit Choudhary @ 2006-10-22 20:37 UTC (permalink / raw)
To: Linux Kernel
Description: Check the return value of kmalloc() in function setup_cpu_cache(), in file mm/slab.c.
Signed-off-by: Amit Choudhary <amit2030@gmail.com>
diff --git a/mm/slab.c b/mm/slab.c
index 84c631f..613ae61 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2021,6 +2021,7 @@ static int setup_cpu_cache(struct kmem_c
} else {
cachep->array[smp_processor_id()] =
kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
+ BUG_ON(!cachep->array[smp_processor_id()]);
if (g_cpucache_up == PARTIAL_AC) {
set_up_list3s(cachep, SIZE_L3);
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2.6.19-rc2] mm/slab.c: check kmalloc() return value.
2006-10-22 20:37 [PATCH 2.6.19-rc2] mm/slab.c: check kmalloc() return value Amit Choudhary
@ 2006-10-22 21:16 ` Josef Sipek
2006-10-22 22:10 ` Dave Jones
2006-10-23 6:38 ` Pekka Enberg
1 sibling, 1 reply; 4+ messages in thread
From: Josef Sipek @ 2006-10-22 21:16 UTC (permalink / raw)
To: Amit Choudhary; +Cc: Linux Kernel
On Sun, Oct 22, 2006 at 01:37:51PM -0700, Amit Choudhary wrote:
> Description: Check the return value of kmalloc() in function setup_cpu_cache(), in file mm/slab.c.
>
> Signed-off-by: Amit Choudhary <amit2030@gmail.com>
>
> diff --git a/mm/slab.c b/mm/slab.c
> index 84c631f..613ae61 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2021,6 +2021,7 @@ static int setup_cpu_cache(struct kmem_c
> } else {
> cachep->array[smp_processor_id()] =
> kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
> + BUG_ON(!cachep->array[smp_processor_id()]);
>
> if (g_cpucache_up == PARTIAL_AC) {
> set_up_list3s(cachep, SIZE_L3);
Any reason to BUG instead of trying to return as gracefully as possible?
Josef "Jeff" Sipek.
--
My public GPG key can be found at
http://www.josefsipek.net/gpg/public-0xC7958FFE.txt
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2.6.19-rc2] mm/slab.c: check kmalloc() return value.
2006-10-22 21:16 ` Josef Sipek
@ 2006-10-22 22:10 ` Dave Jones
0 siblings, 0 replies; 4+ messages in thread
From: Dave Jones @ 2006-10-22 22:10 UTC (permalink / raw)
To: Josef Sipek; +Cc: Amit Choudhary, Linux Kernel
On Sun, Oct 22, 2006 at 05:16:05PM -0400, Josef Sipek wrote:
> On Sun, Oct 22, 2006 at 01:37:51PM -0700, Amit Choudhary wrote:
> > Description: Check the return value of kmalloc() in function setup_cpu_cache(), in file mm/slab.c.
> >
> > Signed-off-by: Amit Choudhary <amit2030@gmail.com>
> >
> > diff --git a/mm/slab.c b/mm/slab.c
> > index 84c631f..613ae61 100644
> > --- a/mm/slab.c
> > +++ b/mm/slab.c
> > @@ -2021,6 +2021,7 @@ static int setup_cpu_cache(struct kmem_c
> > } else {
> > cachep->array[smp_processor_id()] =
> > kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
> > + BUG_ON(!cachep->array[smp_processor_id()]);
> >
> > if (g_cpucache_up == PARTIAL_AC) {
> > set_up_list3s(cachep, SIZE_L3);
>
> Any reason to BUG instead of trying to return as gracefully as possible?
If we fail to allocate memory this early in boot, we're hosed anyway.
Dave
--
http://www.codemonkey.org.uk
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2.6.19-rc2] mm/slab.c: check kmalloc() return value.
2006-10-22 20:37 [PATCH 2.6.19-rc2] mm/slab.c: check kmalloc() return value Amit Choudhary
2006-10-22 21:16 ` Josef Sipek
@ 2006-10-23 6:38 ` Pekka Enberg
1 sibling, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2006-10-23 6:38 UTC (permalink / raw)
To: Amit Choudhary; +Cc: Linux Kernel, akpm
On 10/22/06, Amit Choudhary <amit2030@gmail.com> wrote:
> diff --git a/mm/slab.c b/mm/slab.c
> index 84c631f..613ae61 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2021,6 +2021,7 @@ static int setup_cpu_cache(struct kmem_c
> } else {
> cachep->array[smp_processor_id()] =
> kmalloc(sizeof(struct arraycache_init), GFP_KERNEL);
> + BUG_ON(!cachep->array[smp_processor_id()]);
>
> if (g_cpucache_up == PARTIAL_AC) {
> set_up_list3s(cachep, SIZE_L3);
Looks good. You might want to send this to akpm@osdl.org directly.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-10-23 6:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-22 20:37 [PATCH 2.6.19-rc2] mm/slab.c: check kmalloc() return value Amit Choudhary
2006-10-22 21:16 ` Josef Sipek
2006-10-22 22:10 ` Dave Jones
2006-10-23 6:38 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox