From: WANG Cong <xiyou.wangcong@gmail.com>
To: Dave Hansen <haveblue@us.ibm.com>
Cc: WANG Cong <xiyou.wangcong@gmail.com>,
LKML <linux-kernel@vger.kernel.org>,
Rik van Riel <riel@redhat.com>,
Christoph Lameter <clameter@sgi.com>,
Andrew Morton <akpm@osdl.org>,
linux-mm@kvack.org
Subject: Re: [Patch] mm/sparse.c: Check the return value of sparse_index_alloc().
Date: Tue, 20 Nov 2007 12:57:37 +0800 [thread overview]
Message-ID: <20071120045737.GE2472@hacking> (raw)
In-Reply-To: <1195507022.27759.146.camel@localhost>
On Mon, Nov 19, 2007 at 01:17:02PM -0800, Dave Hansen wrote:
>On Thu, 2007-11-15 at 21:54 +0800, WANG Cong wrote:
>> Since sparse_index_alloc() can return NULL on memory allocation failure,
>> we must deal with the failure condition when calling it.
>>
>> Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
>> Cc: Christoph Lameter <clameter@sgi.com>
>> Cc: Rik van Riel <riel@redhat.com>
>>
>> ---
>>
>> diff --git a/Makefile b/Makefile
>> diff --git a/mm/sparse.c b/mm/sparse.c
>> index e06f514..d245e59 100644
>> --- a/mm/sparse.c
>> +++ b/mm/sparse.c
>> @@ -83,6 +83,8 @@ static int __meminit sparse_index_init(unsigned long section_nr, int nid)
>> return -EEXIST;
>>
>> section = sparse_index_alloc(nid);
>> + if (!section)
>> + return -ENOMEM;
>> /*
>> * This lock keeps two different sections from
>> * reallocating for the same index
>
>Oddly enough, sparse_add_one_section() doesn't seem to like to check
>its allocations. The usemap is checked, but not freed on error. If you
>want to fix this up, I think it needs a little more love than just two
>lines.
Er, right. I missed this point.
>
>Do you want to try to add some actual error handling to
>sparse_add_one_section()?
Yes, I will have a try. And memory_present() also doesn't check it.
More patches around this will come up soon. Since Andrew has included
the above patch, so I won't remake it with others together.
Andrew, is this OK for you?
Thanks.
--
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:[~2007-11-20 5:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-15 13:54 [Patch] mm/sparse.c: Check the return value of sparse_index_alloc() WANG Cong
2007-11-16 21:37 ` Andrew Morton
2007-11-19 21:17 ` Dave Hansen
2007-11-20 4:57 ` WANG Cong [this message]
2007-11-23 5:51 ` [Patch] mm/sparse.c: Improve the error handling for sparse_add_one_section() WANG Cong
2007-11-26 10:19 ` Yasunori Goto
2007-11-27 2:26 ` [Patch](Resend) " WANG Cong
2007-11-27 11:55 ` Yasunori Goto
2007-11-27 18:53 ` Dave Hansen
2007-11-28 12:44 ` WANG Cong
2007-11-29 2:42 ` Yasunori Goto
2007-11-29 17:47 ` Dave Hansen
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=20071120045737.GE2472@hacking \
--to=xiyou.wangcong@gmail.com \
--cc=akpm@osdl.org \
--cc=clameter@sgi.com \
--cc=haveblue@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@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;
as well as URLs for NNTP newsgroup(s).