mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Christoph Lameter <clameter@sgi.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [RFC] fix slub krealloc()
Date: Wed, 18 Jul 2007 17:42:11 +0200	[thread overview]
Message-ID: <1184773331.4002.4.camel@johannes.berg> (raw)

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)

johannes

---
 mm/slub.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- wireless-dev.orig/mm/slub.c	2007-07-18 16:25:11.809440194 +0200
+++ wireless-dev/mm/slub.c	2007-07-18 16:25:22.809440194 +0200
@@ -2394,7 +2394,7 @@ size_t ksize(const void *object)
 	struct page *page;
 	struct kmem_cache *s;
 
-	if (object == ZERO_SIZE_PTR)
+	if (object == ZERO_SIZE_PTR || !object)
 		return 0;
 
 	page = get_object_page(object);



             reply	other threads:[~2007-07-18 16:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-18 15:42 Johannes Berg [this message]
2007-07-23 20:32 ` Christoph Lameter
2007-07-23 20:47   ` Andrew Morton
2007-07-23 21:37     ` Christoph Lameter
2007-07-25  8:40       ` Johannes Berg
2007-07-25 18:53         ` Christoph Lameter
2007-07-26 14:08           ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1184773331.4002.4.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®