summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/dmresrc.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-02-28 20:23:30 +0000
committernjl <njl@FreeBSD.org>2004-02-28 20:23:30 +0000
commit4335e07b6601dee959fdc8ee35b4cd21f3171c81 (patch)
tree885c1ceace8766961e3a5baedf4ef67ce438b844 /sys/contrib/dev/acpica/dmresrc.c
parent041f94a8baba77aa39abb282f948d95e42507781 (diff)
downloadFreeBSD-src-4335e07b6601dee959fdc8ee35b4cd21f3171c81.zip
FreeBSD-src-4335e07b6601dee959fdc8ee35b4cd21f3171c81.tar.gz
Vendor import of ACPICA 20040220
Diffstat (limited to 'sys/contrib/dev/acpica/dmresrc.c')
-rw-r--r--sys/contrib/dev/acpica/dmresrc.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/contrib/dev/acpica/dmresrc.c b/sys/contrib/dev/acpica/dmresrc.c
index 437bf5c..ce89d08 100644
--- a/sys/contrib/dev/acpica/dmresrc.c
+++ b/sys/contrib/dev/acpica/dmresrc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrc.c - Resource Descriptor disassembly
- * $Revision: 10 $
+ * $Revision: 13 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -433,9 +433,16 @@ AcpiDmIsResourceDescriptor (
ByteCount = (UINT32) NextOp->Common.Value.Integer;
ByteData = NextOp->Named.Data;
- /* The list must have a valid END_TAG */
+ /* Absolute minimum descriptor is an END_TAG (2 bytes) */
- if (ByteData[ByteCount-1] != (ACPI_RDESC_TYPE_END_TAG | 1))
+ if (ByteCount < 2)
+ {
+ return (FALSE);
+ }
+
+ /* The list must have a valid 2-byte END_TAG */
+
+ if (ByteData[ByteCount-2] != (ACPI_RDESC_TYPE_END_TAG | 1))
{
return FALSE;
}
@@ -444,7 +451,7 @@ AcpiDmIsResourceDescriptor (
* Walk the byte list. Abort on any invalid descriptor ID or
* or length
*/
- for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; )
+ for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;)
{
CurrentByte = ByteData[CurrentByteOffset];
@@ -479,6 +486,7 @@ AcpiDmIsResourceDescriptor (
case ACPI_RDESC_TYPE_IO_PORT:
case ACPI_RDESC_TYPE_FIXED_IO_PORT:
case ACPI_RDESC_TYPE_SMALL_VENDOR:
+
/*
* "Large" type descriptors
*/
OpenPOWER on IntegriCloud