Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi/acpica As in Linux, prevent BIOS from trying to...



details:   https://anonhg.NetBSD.org/src/rev/b4a8571df495
branches:  trunk
changeset: 778946:b4a8571df495
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sun Apr 22 06:33:04 2012 +0000

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

diffstat:

 sys/dev/acpi/acpica/OsdMemory.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r d05dd6daf4fd -r b4a8571df495 sys/dev/acpi/acpica/OsdMemory.c
--- a/sys/dev/acpi/acpica/OsdMemory.c   Sun Apr 22 05:24:39 2012 +0000
+++ b/sys/dev/acpi/acpica/OsdMemory.c   Sun Apr 22 06:33:04 2012 +0000
@@ -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 @@
 void *
 AcpiOsMapMemory(ACPI_PHYSICAL_ADDRESS PhysicalAddress, ACPI_SIZE Length)
 {
+       void *LogicalAddress = NULL;
        ACPI_STATUS Status;
-       void *LogicalAddress = NULL;
+
+       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;
 }
 



Home | Main Index | Thread Index | Old Index