⬢ DragonFlyBSD Kernel Audit
DF-2590 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/acpica/acpi_panasonic/acpi_panasonic.c	2026-10-19
+++ b/sys/dev/acpica/acpi_panasonic/acpi_panasonic.c
@@ -228,7 +228,9 @@
 	/* Mute the main audio during reboot to prevent static burst to speaker. */
 	sc = device_get_softc(dev);
 	mute = 1;
+	ACPI_SERIAL_BEGIN(panasonic);
 	hkey_sound_mute(sc->handle, HKEY_SET, &mute);
+	ACPI_SERIAL_END(panasonic);
 	return (0);
 }
 
@@ -274,11 +276,15 @@
 	ret = -1;
 	buf.Length = ACPI_ALLOCATE_BUFFER;
 	buf.Pointer = NULL;
-	AcpiEvaluateObject(h, "SINF", NULL, &buf);
+	if (ACPI_FAILURE(AcpiEvaluateObject(h, "SINF", NULL, &buf)))
+		goto out;
 	res = (ACPI_OBJECT *)buf.Pointer;
-	if (res->Type == ACPI_TYPE_PACKAGE)
+	if (res != NULL && res->Type == ACPI_TYPE_PACKAGE &&
+	    index < res->Package.Count)
 		ret = res->Package.Elements[index].Integer.Value;
-	AcpiOsFree(buf.Pointer);
+out:
+	if (buf.Pointer != NULL)
+		AcpiOsFree(buf.Pointer);
 
 	return (ret);
 }
@@ -400,9 +406,12 @@
 
 	buf.Length = ACPI_ALLOCATE_BUFFER;
 	buf.Pointer = NULL;
-	AcpiEvaluateObject(h, "HINF", NULL, &buf);
+	if (ACPI_FAILURE(AcpiEvaluateObject(h, "HINF", NULL, &buf))) {
+		device_printf(sc->dev, "HINF evaluation failed\n");
+		goto end;
+	}
 	res = (ACPI_OBJECT *)buf.Pointer;
-	if (res->Type != ACPI_TYPE_INTEGER) {
+	if (res == NULL || res->Type != ACPI_TYPE_INTEGER) {
 		device_printf(sc->dev, "HINF returned non-integer\n");
 		goto end;
 	}