mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@digeo.com>
To: Andries.Brouwer@cwi.nl
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH?] slab.c
Date: Sun, 26 Jan 2003 19:18:48 -0800	[thread overview]
Message-ID: <20030126191848.0dbbdb54.akpm@digeo.com> (raw)
In-Reply-To: <UTC200301262314.h0QNEWm00231.aeb@smtp.cwi.nl>

Andries.Brouwer@cwi.nl wrote:
>
> In slab.c the routine check_poison_obj() is called.
> That routine does nothing except return 0 or 1.
> Thus it looks like the present call in slab_destroy()
> is meaningless. Perhaps something like this was meant?
> 

Sharp eyes.  It obviously got lost somewhere.

We've been moving away from generating informationless BUG()s in there,
toward emitting more info and trying to continue.  So I made this change:

diff -puN mm/slab.c~slab-poisoning-fix mm/slab.c
--- 25/mm/slab.c~slab-poisoning-fix	2003-01-26 19:10:54.000000000 -0800
+++ 25-akpm/mm/slab.c	2003-01-26 19:13:01.000000000 -0800
@@ -769,7 +769,7 @@ static void poison_obj(kmem_cache_t *cac
 	*(unsigned char *)(addr+size-1) = POISON_END;
 }
 
-static int check_poison_obj (kmem_cache_t *cachep, void *addr)
+static void check_poison_obj(kmem_cache_t *cachep, void *addr)
 {
 	int size = cachep->objsize;
 	void *end;
@@ -779,8 +779,7 @@ static int check_poison_obj (kmem_cache_
 	}
 	end = memchr(addr, POISON_END, size);
 	if (end != (addr+size-1))
-		return 1;
-	return 0;
+		slab_error(cachep, "object was modified after freeing");
 }
 #endif
 
@@ -1630,8 +1629,7 @@ cache_alloc_debugcheck_after(kmem_cache_
 	if (!objp)	
 		return objp;
 	if (cachep->flags & SLAB_POISON)
-		if (check_poison_obj(cachep, objp))
-			BUG();
+		check_poison_obj(cachep, objp);
 	if (cachep->flags & SLAB_RED_ZONE) {
 		/* Set alloc red-zone, and check old one. */
 		if (xchg((unsigned long *)objp, RED_ACTIVE) != RED_INACTIVE)



      reply	other threads:[~2003-01-27  3:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-26 23:14 Andries.Brouwer
2003-01-27  3:18 ` Andrew Morton [this message]

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=20030126191848.0dbbdb54.akpm@digeo.com \
    --to=akpm@digeo.com \
    --cc=Andries.Brouwer@cwi.nl \
    --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®