linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jianguo Wu <wujianguo@huawei.com>
To: Petr Holasek <pholasek@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>, Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/ksm: return NULL when doesn't get mergeable page
Date: Sun, 22 Sep 2013 08:54:30 +0800	[thread overview]
Message-ID: <523E3FC6.7020009@huawei.com> (raw)
In-Reply-To: <20130919083329.GA1620@thinkpad-work.brq.redhat.com>

On 2013/9/19 16:33, Petr Holasek wrote:

> On Mon, 16 Sep 2013, Jianguo Wu wrote:
>> In get_mergeable_page() local variable page is not initialized,
>> it may hold a garbage value, when find_mergeable_vma() return NULL,
>> get_mergeable_page() may return a garbage value to the caller.
>>
>> So initialize page as NULL.
>>
>> Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
>> ---
>>  mm/ksm.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/mm/ksm.c b/mm/ksm.c
>> index b6afe0c..87efbae 100644
>> --- a/mm/ksm.c
>> +++ b/mm/ksm.c
>> @@ -460,7 +460,7 @@ static struct page *get_mergeable_page(struct rmap_item *rmap_item)
>>  	struct mm_struct *mm = rmap_item->mm;
>>  	unsigned long addr = rmap_item->address;
>>  	struct vm_area_struct *vma;
>> -	struct page *page;
>> +	struct page *page = NULL;
>>  
>>  	down_read(&mm->mmap_sem);
>>  	vma = find_mergeable_vma(mm, addr);
>> -- 
>> 1.7.1
>>
> 
> When find_mergeable_vma returned NULL, NULL is assigned to page in "out"
> statement.
> 

Oh, yes, thanks, Petr.

> 



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

      reply	other threads:[~2013-09-22  0:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16 12:41 [PATCH] mm/ksm: return NULL when doesn't get mergeable page Jianguo Wu
2013-09-19  8:33 ` Petr Holasek
2013-09-22  0:54   ` Jianguo Wu [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=523E3FC6.7020009@huawei.com \
    --to=wujianguo@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=pholasek@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).