* [PATCH] x86/e820: fix e820_search_gap() error handling on x86-32
@ 2017-01-11 14:49 Arnd Bergmann
2017-01-12 10:07 ` [tip:x86/boot] x86/e820/32: Fix " tip-bot for Arnd Bergmann
2017-01-25 15:48 ` [PATCH] x86/e820: fix " Wei Yang
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-01-11 14:49 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86
Cc: Arnd Bergmann, Denys Vlasenko, Wei Yang, Dan Williams, Toshi Kani,
linux-kernel
gcc correctly points out that on 32-bit kernels, e820_search_gap()
not finding a start now leads to pci_mem_start being set to an
uninitialized value:
arch/x86/kernel/e820.c: In function 'e820_setup_gap':
arch/x86/kernel/e820.c:641:16: error: 'gapstart' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This restores the behavior from before the cleanup, defaulting
to address 0x10000000 if nothing was found.
Fixes: b4ed1d15b453 ("x86/e820: Make e820_search_gap() static and remove unused variables")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/kernel/e820.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 46f2afd3577a..b2bbad6ebe4d 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -626,14 +626,16 @@ __init void e820_setup_gap(void)
gapsize = 0x400000;
found = e820_search_gap(&gapstart, &gapsize);
-#ifdef CONFIG_X86_64
if (!found) {
+#ifdef CONFIG_X86_64
gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024;
printk(KERN_ERR
"e820: cannot find a gap in the 32bit address range\n"
"e820: PCI devices with unassigned 32bit BARs may break!\n");
- }
+#else
+ gapstart = 0x10000000;
#endif
+ }
/*
* e820_reserve_resources_late protect stolen RAM already
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [tip:x86/boot] x86/e820/32: Fix e820_search_gap() error handling on x86-32
2017-01-11 14:49 [PATCH] x86/e820: fix e820_search_gap() error handling on x86-32 Arnd Bergmann
@ 2017-01-12 10:07 ` tip-bot for Arnd Bergmann
2017-01-25 15:48 ` [PATCH] x86/e820: fix " Wei Yang
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Arnd Bergmann @ 2017-01-12 10:07 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, torvalds, peterz, toshi.kani, richard.weiyang, mingo,
dvlasenk, dan.j.williams, linux-kernel, tglx, arnd
Commit-ID: c19a5f35e315837170ee337eed21c7087ea94192
Gitweb: http://git.kernel.org/tip/c19a5f35e315837170ee337eed21c7087ea94192
Author: Arnd Bergmann <arnd@arndb.de>
AuthorDate: Wed, 11 Jan 2017 15:49:04 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 12 Jan 2017 09:40:06 +0100
x86/e820/32: Fix e820_search_gap() error handling on x86-32
GCC correctly points out that on 32-bit kernels, e820_search_gap()
not finding a start now leads to pci_mem_start ('gapstart') being set to an
uninitialized value:
arch/x86/kernel/e820.c: In function 'e820_setup_gap':
arch/x86/kernel/e820.c:641:16: error: 'gapstart' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This restores the behavior from before this cleanup:
b4ed1d15b453 ("x86/e820: Make e820_search_gap() static and remove unused variables")
... defaulting to address 0x10000000 if nothing was found.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hpe.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Fixes: b4ed1d15b453 ("x86/e820: Make e820_search_gap() static and remove unused variables")
Link: http://lkml.kernel.org/r/20170111144926.695369-1-arnd@arndb.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/kernel/e820.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 46f2afd..b2bbad6 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -626,14 +626,16 @@ __init void e820_setup_gap(void)
gapsize = 0x400000;
found = e820_search_gap(&gapstart, &gapsize);
-#ifdef CONFIG_X86_64
if (!found) {
+#ifdef CONFIG_X86_64
gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024;
printk(KERN_ERR
"e820: cannot find a gap in the 32bit address range\n"
"e820: PCI devices with unassigned 32bit BARs may break!\n");
- }
+#else
+ gapstart = 0x10000000;
#endif
+ }
/*
* e820_reserve_resources_late protect stolen RAM already
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/e820: fix e820_search_gap() error handling on x86-32
2017-01-11 14:49 [PATCH] x86/e820: fix e820_search_gap() error handling on x86-32 Arnd Bergmann
2017-01-12 10:07 ` [tip:x86/boot] x86/e820/32: Fix " tip-bot for Arnd Bergmann
@ 2017-01-25 15:48 ` Wei Yang
1 sibling, 0 replies; 3+ messages in thread
From: Wei Yang @ 2017-01-25 15:48 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, Denys Vlasenko,
Wei Yang, Dan Williams, Toshi Kani, linux-kernel
You are right. Thanks :-)
On Wed, Jan 11, 2017 at 03:49:04PM +0100, Arnd Bergmann wrote:
>gcc correctly points out that on 32-bit kernels, e820_search_gap()
>not finding a start now leads to pci_mem_start being set to an
>uninitialized value:
>
>arch/x86/kernel/e820.c: In function 'e820_setup_gap':
>arch/x86/kernel/e820.c:641:16: error: 'gapstart' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
>This restores the behavior from before the cleanup, defaulting
>to address 0x10000000 if nothing was found.
>
>Fixes: b4ed1d15b453 ("x86/e820: Make e820_search_gap() static and remove unused variables")
>Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>---
> arch/x86/kernel/e820.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
>diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
>index 46f2afd3577a..b2bbad6ebe4d 100644
>--- a/arch/x86/kernel/e820.c
>+++ b/arch/x86/kernel/e820.c
>@@ -626,14 +626,16 @@ __init void e820_setup_gap(void)
> gapsize = 0x400000;
> found = e820_search_gap(&gapstart, &gapsize);
>
>-#ifdef CONFIG_X86_64
> if (!found) {
>+#ifdef CONFIG_X86_64
> gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024;
> printk(KERN_ERR
> "e820: cannot find a gap in the 32bit address range\n"
> "e820: PCI devices with unassigned 32bit BARs may break!\n");
>- }
>+#else
>+ gapstart = 0x10000000;
> #endif
>+ }
>
> /*
> * e820_reserve_resources_late protect stolen RAM already
>--
>2.9.0
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-25 15:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-11 14:49 [PATCH] x86/e820: fix e820_search_gap() error handling on x86-32 Arnd Bergmann
2017-01-12 10:07 ` [tip:x86/boot] x86/e820/32: Fix " tip-bot for Arnd Bergmann
2017-01-25 15:48 ` [PATCH] x86/e820: fix " Wei Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox