[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1302060017410.6630@chino.kir.corp.google.com>
Date: Wed, 6 Feb 2013 00:27:01 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Shuah Khan <shuah.khan@...com>
cc: Andrew Morton <akpm@...ux-foundation.org>, tglx@...utronix.de,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
yinghai@...nel.org, tangchen@...fujitsu.com, wency@...fujitsu.com,
linux-kernel@...r.kernel.org, x86@...nel.org, shuahkhan@...il.com
Subject: Re: [PATCH linux-next] x86/mm: Fix compile warning in
remove_pagetable()
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. Or, even better, change
this into the standard do-while loop that everything else uses.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists