Re: linux-next: build warning after merge of the tip tree

Wu Fengguang
2010-09-03T09:04:07Z

On Fri, Sep 03, 2010 at 10:12:01AM +0800, Stephen Rothwell wrote:
> On Fri, 3 Sep 2010 12:10:23 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > After merging the tip tree, today's linux-next build (x86_64 allmodconfig)
> > produced this warning:
> >
> > arch/x86/mm/init_64.c: In function 'kernel_physical_mapping_init':
> > arch/x86/mm/init_64.c:601: warning: 'addr' may be used uninitialized in this function
> >
> > The code does look suspicious ... 'addr' gets declared and then passed to
> > a function, but is not set anywhere ...
>
> Forgot to say:
>
> Introduced by commit 9b861528a8012e7bc4d1f7bae07395b225331477 ("x86-64,
> mem: Update all PGDs for direct mapping and vmemmap mapping changes").

The original patch has the following line, however get lost some time
later:

http://www.spinics.net/lists/linux-mm/msg08152.html

===
x86, mm: fix uninitialized addr in kernel_physical_mapping_init()

This re-adds the lost chunk in commit 9b861528a80.

CC: Haicheng Li <haicheng.li@linux.intel.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 64e7bc2..74f0f35 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -570,6 +570,7 @@ kernel_physical_mapping_init(unsigned long start,

start = (unsigned long)__va(start);
end = (unsigned long)__va(end);
+ addr = start;

for (; start < end; start = next) {
pgd_t *pgd = pgd_offset_k(start);