[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070723133206.2220db7e@schroedinger.engr.sgi.com>
Date: Mon, 23 Jul 2007 13:32:06 -0700
From: Christoph Lameter <clameter@....com>
To: Johannes Berg <johannes@...solutions.net>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
akpm@...ux-foundation.org
Subject: Re: [RFC] fix slub krealloc()
On Wed, 18 Jul 2007 17:42:11 +0200
Johannes Berg <johannes@...solutions.net> 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, x, gfp) is
> equivalent to kmalloc(x, gfp) and that's not true any more even after
> this patch when you do krealloc(NULL, 0, gfp)
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.c 2007-07-23 13:29:42.000000000 -0700
+++ linux-2.6/mm/util.c 2007-07-23 13:31:28.000000000 -0700
@@ -88,7 +88,11 @@ void *krealloc(const void *p, size_t new
return ZERO_SIZE_PTR;
}
- ks = ksize(p);
+ if (p)
+ ks = ksize(p);
+ else
+ ks = 0;
+
if (ks >= new_size)
return (void *)p;
-
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