From: Matt Mackall <mpm@selenic.com>
To: MinChan Kim <minchan.kim@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, Pekka J Enberg <penberg@cs.helsinki.fi>
Subject: Re: [PATCH] Fix to return wrong pointer in slob
Date: Mon, 19 May 2008 12:40:37 -0500 [thread overview]
Message-ID: <1211218837.18026.116.camel@calx> (raw)
In-Reply-To: <48317CA8.1080700@gmail.com>
On Mon, 2008-05-19 at 22:12 +0900, MinChan Kim wrote:
> Although slob_alloc return NULL, __kmalloc_node returns NULL + align.
> Because align always can be changed, it is very hard for debugging
> problem of no page if it don't return NULL.
>
> We have to return NULL in case of no page.
>
> Signed-off-by: MinChan Kim <minchan.kim@gmail.com>
> ---
> mm/slob.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/mm/slob.c b/mm/slob.c
> index 6038cba..258d76d 100644
> --- a/mm/slob.c
> +++ b/mm/slob.c
> @@ -469,9 +469,12 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
> return ZERO_SIZE_PTR;
>
> m = slob_alloc(size + align, gfp, align, node);
> - if (m)
> - *m = size;
> - return (void *)m + align;
> + if (!m)
> + return NULL;
> + else {
> + *m = size;
> + return (void *)m + align;
> + }
This looks good, but I would remove the 'else {' and '}' here. It's nice
to have the 'normal path' minimally indented.
Otherwise,
Acked-by: Matt Mackall <mpm@selenic.com>
[cc:ed to Pekka, who manages the allocator tree]
> } else {
> void *ret;
>
--
Mathematics is the supreme nostalgia of our time.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-05-19 17:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-19 13:12 [PATCH] Fix to return wrong pointer in slob MinChan Kim
2008-05-19 17:40 ` Matt Mackall [this message]
2008-05-19 17:55 ` Pekka Enberg
2008-05-20 2:32 ` MinChan Kim
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=1211218837.18026.116.camel@calx \
--to=mpm@selenic.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan.kim@gmail.com \
--cc=penberg@cs.helsinki.fi \
/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;
as well as URLs for NNTP newsgroup(s).