The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Tang Chen <tangchen@cn.fujitsu.com>
To: David Rientjes <rientjes@google.com>
Cc: Shuah Khan <shuah.khan@hp.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	tglx@linutronix.de, "H. Peter Anvin" <hpa@zytor.com>,
	Ingo Molnar <mingo@redhat.com>,
	yinghai@kernel.org, wency@cn.fujitsu.com,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	shuahkhan@gmail.com
Subject: Re: [PATCH linux-next] x86/mm: Fix compile warning in remove_pagetable()
Date: Wed, 06 Feb 2013 16:30:27 +0800	[thread overview]
Message-ID: <511214A3.6060201@cn.fujitsu.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1302060017410.6630@chino.kir.corp.google.com>

On 02/06/2013 04:27 PM, David Rientjes wrote:
> On Tue, 5 Feb 2013, Shuah Khan wrote:
>
>> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
>> index 67bad4b..ed78400 100644
>> --- a/arch/x86/mm/init_64.c
>> +++ b/arch/x86/mm/init_64.c
>> @@ -987,7 +987,7 @@ remove_pud_table(pud_t *pud_start, unsigned long addr, unsigned long end,
>>   static void __meminit
>>   remove_pagetable(unsigned long start, unsigned long end, bool direct)
>>   {
>> -	unsigned long next;
>> +	unsigned long next = pgd_addr_end(start, end);
>>   	pgd_t *pgd;
>>   	pud_t *pud;
>>   	bool pgd_changed = false;
>
> This isn't enough, there's a potential for an infinite loop if
> !pgd_present() is ever true in the iteration since "next" remains
> constant.  Theoretical, maybe.
>
> I think it's better to just set next before checking for !pgd_present() in
> the iteration so it's clear what's happening.

Yes, Andrew's patch just fixed it like this. :)

Thanks. :)

> Or, even better, change
> this into the standard do-while loop that everything else uses.
>


      reply	other threads:[~2013-02-06  8:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06  2:52 [PATCH linux-next] x86/mm: Fix compile warning in remove_pagetable() Shuah Khan
2013-02-06  4:24 ` Yinghai Lu
2013-02-06  8:27 ` David Rientjes
2013-02-06  8:30   ` Tang Chen [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=511214A3.6060201@cn.fujitsu.com \
    --to=tangchen@cn.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rientjes@google.com \
    --cc=shuah.khan@hp.com \
    --cc=shuahkhan@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=wency@cn.fujitsu.com \
    --cc=x86@kernel.org \
    --cc=yinghai@kernel.org \
    /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