Re: [RFC] fix slub krealloc()

2007-07-26 Thread Johannes Berg
On Wed, 2007-07-25 at 11:53 -0700, Christoph Lameter wrote: > It will give you a ZERO_SIZE_PTR > > void *krealloc(const void *p, size_t new_size, gfp_t flags) > { > void *ret; > size_t ks; > > if (unlikely(!new_size)) { > kfree(p); > return

Re: [RFC] fix slub krealloc()

2007-07-25 Thread Christoph Lameter
On Wed, 25 Jul 2007, Johannes Berg wrote: > > > > There is no use of ZERO_OR_NULL ptr in krealloc. Linus added a check to > > ksize() instead so that ksize(NULL) returns 0 instead of failing. > > However, this still doesn't fix the other corner case I pointed out: > krealloc(NULL, 0, GFP_KERNEL)

Re: [RFC] fix slub krealloc()

2007-07-25 Thread Johannes Berg
> > I think we already fixed this? > > Fix ZERO_OR_NULL_PTR(ZERO_SIZE_PTR) > > There is no use of ZERO_OR_NULL ptr in krealloc. Linus added a check to > ksize() instead so that ksize(NULL) returns 0 instead of failing. However, this still doesn't fix the other corner case I pointed out: kre

Re: [RFC] fix slub krealloc()

2007-07-23 Thread Christoph Lameter
On Mon, 23 Jul 2007 13:47:13 -0700 Andrew Morton <[EMAIL PROTECTED]> wrote: > > Right. We need to fix util.c. ksize should not be called with a NULL > > parameter. > > Index: linux-2.6/mm/util.c > > === > > --- linux-2.6.orig/mm/util

Re: [RFC] fix slub krealloc()

2007-07-23 Thread Andrew Morton
On Mon, 23 Jul 2007 13:32:06 -0700 Christoph Lameter <[EMAIL PROTECTED]> wrote: > On Wed, 18 Jul 2007 17:42:11 +0200 > Johannes Berg <[EMAIL PROTECTED]> wrote: > > > Commit ef2ad80c7d255ed0449eda947c2d700635b7e0f5 breaks > > krealloc(NULL, ...) badly, it BUG_ON()s. > > > > This patch fixes it bu

Re: [RFC] fix slub krealloc()

2007-07-23 Thread Christoph Lameter
On Wed, 18 Jul 2007 17:42:11 +0200 Johannes Berg <[EMAIL PROTECTED]> wrote: > Commit ef2ad80c7d255ed0449eda947c2d700635b7e0f5 breaks > krealloc(NULL, ...) badly, it BUG_ON()s. > > This patch fixes it but the fix should probably be in mm/util.c > because the documentation says that krealloc(NULL,