
From: Rik van Riel <riel@redhat.com>

In unprivileged Xen domains, all that __ioremap() does is a "return NULL",
which causes dmi_iterate() to crash the kernel at boot time.

This trivial check bails dmi_iterate() out of the loop when it finds that
the ioremap() returned a NULL pointer.

(akpm: this fix goes beyond xen - ioremap can return NULL)

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/arch/i386/kernel/dmi_scan.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN arch/i386/kernel/dmi_scan.c~fix-xenu-kernel-crash-in-dmi_iterate arch/i386/kernel/dmi_scan.c
--- 25/arch/i386/kernel/dmi_scan.c~fix-xenu-kernel-crash-in-dmi_iterate	Fri Jan 14 15:28:06 2005
+++ 25-akpm/arch/i386/kernel/dmi_scan.c	Fri Jan 14 15:29:14 2005
@@ -109,7 +109,10 @@ static int __init dmi_iterate(void (*dec
 	 * so early in setup that sucker gets confused into doing what
 	 * it shouldn't if we actually call it.
 	 */
-	for (p = q = ioremap(0xF0000, 0x10000); q < p + 0x10000; q += 16) {
+	p = ioremap(0xF0000, 0x10000);
+	if (p == NULL)
+		return -1;
+	for (q = p; q < p + 0x10000; q += 16) {
 		memcpy_fromio(buf, q, 15);
 		if(memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf))
 		{
_
