From: Jesper Juhl <juhl-lkml@dif.dk>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Arjan van de Ven <arjan@infradead.org>,
ecashin@noserose.net, Greg K-H <greg@kroah.com>,
Jens Axboe <axboe@suse.de>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH] make mempool_destroy resilient against NULL pointers.
Date: Sat, 9 Apr 2005 03:41:07 +0200 (CEST) [thread overview]
Message-ID: <Pine.LNX.4.62.0504090334490.2455@dragon.hyggekrogen.localhost> (raw)
General rule (as I understand it) is that functions that free resources
should handle being passed NULL pointers - mempool_destroy() will
currently explode if passed a NULL pointer, the patch below makes it safe
to pass it NULL.
Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
---
mempool.c | 2 ++
1 files changed, 2 insertions(+)
--- linux-2.6.12-rc2-mm2-orig/mm/mempool.c 2005-04-05 21:21:56.000000000 +0200
+++ linux-2.6.12-rc2-mm2/mm/mempool.c 2005-04-09 03:33:58.000000000 +0200
@@ -176,6 +176,8 @@ EXPORT_SYMBOL(mempool_resize);
*/
void mempool_destroy(mempool_t *pool)
{
+ if (!pool)
+ return;
if (pool->curr_nr != pool->min_nr)
BUG(); /* There were outstanding elements */
free_pool(pool);
next reply other threads:[~2005-04-09 1:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-09 1:41 Jesper Juhl [this message]
2005-04-09 1:41 ` Andrew Morton
2005-04-09 1:46 ` Jesper Juhl
2005-04-24 1:32 ` Jesper Juhl
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=Pine.LNX.4.62.0504090334490.2455@dragon.hyggekrogen.localhost \
--to=juhl-lkml@dif.dk \
--cc=akpm@osdl.org \
--cc=arjan@infradead.org \
--cc=axboe@suse.de \
--cc=ecashin@noserose.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/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®