DragonFlyBSD Kernel Audit
DF-1929 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/acpica/acpi_battery.c b/sys/dev/acpica/acpi_battery.c
--- a/sys/dev/acpica/acpi_battery.c
+++ b/sys/dev/acpica/acpi_battery.c
@@ -347,6 +347,8 @@
     dev = NULL;
     found_unit = 0;
     batt_dc = devclass_find("battery");
+    if (batt_dc == NULL)
+	return (NULL);
     maxunit = devclass_get_maxunit(batt_dc);
     for (i = 0; i < maxunit; i++) {
 	dev = devclass_get_device(batt_dc, i);