[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5180CC5B.3010608@kernel.org>
Date: Wed, 01 May 2013 11:03:39 +0300
From: Pekka Enberg <penberg@...nel.org>
To: Christoph Lameter <cl@...ux.com>
CC: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>,
glommer@...allels.com, linux-kernel@...r.kernel.org
Subject: Re: [linux-next-20130422] Bug in SLAB?
On 4/30/13 5:34 PM, Christoph Lameter wrote:
> On Tue, 30 Apr 2013, Tetsuo Handa wrote:
>
>> Current diff is:
>
> [off by one stuff okay]
>
>> diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h
>> index 113ec08..be1446a 100644
>> --- a/include/linux/slab_def.h
>> +++ b/include/linux/slab_def.h
>> @@ -126,6 +126,9 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags)
>> if (!size)
>> return ZERO_SIZE_PTR;
>>
>> + if (size > KMALLOC_MAX_SIZE)
>> + goto not_found;
>> +
>> i = kmalloc_index(size);
>
> Why is this needed? kmalloc_index should BUG() for too large allocs.
Why is that? Historically it has returned NULL, hasn't it? We have had
cases where kernel code (naively) uses size directly from userspace and
we definitely don't want to BUG_ON on it.
Pekka
--
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