linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "MinChan Kim" <barrioskmc@gmail.com>
To: Matt Mackall <mpm@selenic.com>
Cc: MinChan Kim <minchan.kim@gmail.com>,
	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: Tue, 20 May 2008 11:32:19 +0900	[thread overview]
Message-ID: <44c63dc40805191932t6a386cb7r389b6e5d3d3bf095@mail.gmail.com> (raw)
In-Reply-To: <1211218837.18026.116.camel@calx>

On Tue, May 20, 2008 at 2:40 AM, Matt Mackall <mpm@selenic.com> wrote:
>
> 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.

I agree
Thanks, Matt :)


-- 
Thanks,
MinChan Kim

--
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>

      parent reply	other threads:[~2008-05-20  2:32 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
2008-05-19 17:55   ` Pekka Enberg
2008-05-20  2:32   ` MinChan Kim [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=44c63dc40805191932t6a386cb7r389b6e5d3d3bf095@mail.gmail.com \
    --to=barrioskmc@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --cc=mpm@selenic.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).