Module Name:    src
Committed By:   jruoho
Date:           Fri Apr  9 04:48:23 UTC 2010

Modified Files:
        src/sys/dev/acpi/wmi: wmi_acpi.c

Log Message:
Fix a potential NULL pointer dereference.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/acpi/wmi/wmi_acpi.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/wmi/wmi_acpi.c
diff -u src/sys/dev/acpi/wmi/wmi_acpi.c:1.2 src/sys/dev/acpi/wmi/wmi_acpi.c:1.3
--- src/sys/dev/acpi/wmi/wmi_acpi.c:1.2	Thu Apr  8 12:36:21 2010
+++ src/sys/dev/acpi/wmi/wmi_acpi.c	Fri Apr  9 04:48:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: wmi_acpi.c,v 1.2 2010/04/08 12:36:21 jruoho Exp $	*/
+/*	$NetBSD: wmi_acpi.c,v 1.3 2010/04/09 04:48:23 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 Jukka Ruohonen <jruoho...@iki.fi>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.2 2010/04/08 12:36:21 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_acpi.c,v 1.3 2010/04/09 04:48:23 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -501,14 +501,14 @@
 	ACPI_OBJECT obj;
 	ACPI_HANDLE hdl;
 
-	hdl = sc->sc_node->ad_handle;
-
 	if (sc == NULL || obuf == NULL)
 		return AE_BAD_PARAMETER;
 
 	if (sc->sc_handler == NULL)
 		return AE_ABORT_METHOD;
 
+	hdl = sc->sc_node->ad_handle;
+
 	obj.Type = ACPI_TYPE_INTEGER;
 	obj.Integer.Value = event;
 

Reply via email to