lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170111144926.695369-1-arnd@arndb.de>
Date:   Wed, 11 Jan 2017 15:49:04 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org
Cc:     Arnd Bergmann <arnd@...db.de>,
        Denys Vlasenko <dvlasenk@...hat.com>,
        Wei Yang <richard.weiyang@...il.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Toshi Kani <toshi.kani@....com>, linux-kernel@...r.kernel.org
Subject: [PATCH] x86/e820: 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 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@...db.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ