Module Name: src
Committed By: gsutre
Date: Tue Nov 2 16:45:48 UTC 2010
Modified Files:
src/sys/dev/acpi: acpi_util.c
Log Message:
acpi_eval_integer: check that the evaluation produced a result.
ok jruoho@
To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpi_util.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/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.5 src/sys/dev/acpi/acpi_util.c:1.6
--- src/sys/dev/acpi/acpi_util.c:1.5 Mon Jun 7 17:13:52 2010
+++ src/sys/dev/acpi/acpi_util.c Tue Nov 2 16:45:48 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_util.c,v 1.5 2010/06/07 17:13:52 jruoho Exp $ */
+/* $NetBSD: acpi_util.c,v 1.6 2010/11/02 16:45:48 gsutre Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.5 2010/06/07 17:13:52 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.6 2010/11/02 16:45:48 gsutre Exp $");
#include <sys/param.h>
@@ -90,6 +90,7 @@
if (handle == NULL)
handle = ACPI_ROOT_OBJECT;
+ (void)memset(&obj, 0, sizeof(obj));
buf.Pointer = &obj;
buf.Length = sizeof(obj);
@@ -98,6 +99,10 @@
if (ACPI_FAILURE(rv))
return rv;
+ /* Check that evaluation produced a return value. */
+ if (buf.Length == 0)
+ return AE_NULL_OBJECT;
+
if (obj.Type != ACPI_TYPE_INTEGER)
return AE_TYPE;