2010-01-15 20:50:07

by David Rientjes

[permalink] [raw]
Subject: [patch] slub: remove impossible condition

`s' cannot be NULL if kmalloc_caches is not NULL.

This conditional would trigger a NULL pointer on `s', anyway, since it is
immediately derefernced if true.

Cc: Christoph Lameter <[email protected]>
Signed-off-by: David Rientjes <[email protected]>
---
mm/slub.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2641,7 +2641,7 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
if (slab_state >= SYSFS)
slabflags |= __SYSFS_ADD_DEFERRED;

- if (!s || !text || !kmem_cache_open(s, flags, text,
+ if (!text || !kmem_cache_open(s, flags, text,
realsize, ARCH_KMALLOC_MINALIGN, slabflags, NULL)) {
s->size = 0;
kfree(text);


2010-01-22 16:37:22

by Pekka Enberg

[permalink] [raw]
Subject: Re: [patch] slub: remove impossible condition

Christoph Lameter wrote:
> On Fri, 15 Jan 2010, David Rientjes wrote:
>
>> `s' cannot be NULL if kmalloc_caches is not NULL.
>>
>> This conditional would trigger a NULL pointer on `s', anyway, since it is
>> immediately derefernced if true.
>
> Ok that was caused by the patches for the dma kmalloc in the -next tree.
>
> Acked-by: Christoph Lameter <[email protected]>

Applied, thanks!

2010-01-15 23:39:08

by Christoph Lameter

[permalink] [raw]
Subject: Re: [patch] slub: remove impossible condition

On Fri, 15 Jan 2010, David Rientjes wrote:

> `s' cannot be NULL if kmalloc_caches is not NULL.
>
> This conditional would trigger a NULL pointer on `s', anyway, since it is
> immediately derefernced if true.

Ok that was caused by the patches for the dma kmalloc in the -next tree.

Acked-by: Christoph Lameter <[email protected]>