Module Name:    src
Committed By:   jruoho
Date:           Sun Apr 22 06:33:05 UTC 2012

Modified Files:
        src/sys/dev/acpi/acpica: OsdMemory.c

Log Message:
As in Linux, prevent BIOS from trying to map addresses beyond ULONG_MAX.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpica/OsdMemory.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpica/OsdMemory.c
diff -u src/sys/dev/acpi/acpica/OsdMemory.c:1.4 src/sys/dev/acpi/acpica/OsdMemory.c:1.5
--- src/sys/dev/acpi/acpica/OsdMemory.c:1.4	Thu Feb 17 10:21:43 2011
+++ src/sys/dev/acpi/acpica/OsdMemory.c	Sun Apr 22 06:33:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: OsdMemory.c,v 1.4 2011/02/17 10:21:43 jruoho Exp $	*/
+/*	$NetBSD: OsdMemory.c,v 1.5 2012/04/22 06:33:04 jruoho Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: OsdMemory.c,v 1.4 2011/02/17 10:21:43 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: OsdMemory.c,v 1.5 2012/04/22 06:33:04 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -61,12 +61,17 @@ MALLOC_DECLARE(M_ACPI);
 void *
 AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_SIZE Length)
 {
-	ACPI_STATUS Status;
 	void *LogicalAddress = NULL;
+	ACPI_STATUS Status;
+
+	if (PhysicalAddress > ULONG_MAX)
+		return NULL;
 
 	Status = acpi_md_OsMapMemory(PhysicalAddress, Length, &LogicalAddress);
-	if (ACPI_FAILURE (Status))
+
+	if (ACPI_FAILURE(Status))
 		return NULL;
+
 	return LogicalAddress;
 }
 

Reply via email to