Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi acpi_eval_integer: check that the evaluation pr...



details:   https://anonhg.NetBSD.org/src/rev/fb914b120493
branches:  trunk
changeset: 758335:fb914b120493
user:      gsutre <gsutre%NetBSD.org@localhost>
date:      Tue Nov 02 16:45:48 2010 +0000

description:
acpi_eval_integer: check that the evaluation produced a result.

ok jruoho@

diffstat:

 sys/dev/acpi/acpi_util.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 6d4973e002c6 -r fb914b120493 sys/dev/acpi/acpi_util.c
--- a/sys/dev/acpi/acpi_util.c  Tue Nov 02 16:39:53 2010 +0000
+++ b/sys/dev/acpi/acpi_util.c  Tue Nov 02 16:45:48 2010 +0000
@@ -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;
 



Home | Main Index | Thread Index | Old Index