fix.diff for DF-4408 — validate the INIT evaluation result in acpi_asus_probe before use, and make the NULL-string branch bail out instead of falling through into strncmp(NULL, ...). Authored against the read-only sys/ tree; never applied there. fix_status: not_testable (no ATK0100/ASUS010 firmware on the audit guest; see env.txt). --- a/sys/dev/acpica/acpi_asus/acpi_asus.c +++ b/sys/dev/acpica/acpi_asus/acpi_asus.c @@ -576,12 +576,26 @@ Buf.Pointer = NULL; Buf.Length = ACPI_ALLOCATE_BUFFER; - AcpiEvaluateObject(sc->handle, "INIT", &Args, &Buf); - Obj = Buf.Pointer; + status = AcpiEvaluateObject(sc->handle, "INIT", &Args, &Buf); + if (ACPI_FAILURE(status)) { + device_printf(dev, "Failed to evaluate INIT: %s\n", + AcpiFormatException(status)); + return (ENXIO); + } + Obj = Buf.Pointer; + if (Obj == NULL || Obj->Type != ACPI_TYPE_STRING) { + device_printf(dev, "INIT returned unexpected object\n"); + AcpiOsFree(Buf.Pointer); + return (ENXIO); + } /* * The Samsung P30 returns a null-pointer from INIT, we * can identify it from the 'ODEM' string in the DSDT. */ if (Obj->String.Pointer == NULL) { @@ -604,9 +618,14 @@ if (strncmp("ASUS010", rstr, 7) == 0) { sc->model = &acpi_eeepc_models[0]; device_set_desc(dev, "ASUS EeePC"); AcpiOsFree(Buf.Pointer); return (0); } + + /* Not a Samsung and not an EeePC: do not fall through to + * the model-name loop below with a NULL string pointer. */ + device_printf(dev, "Unsupported laptop (NULL INIT string)\n"); + AcpiOsFree(Buf.Pointer); + return (ENXIO); } sb = sbuf_new_auto(); (locals: add "ACPI_STATUS status;" to acpi_asus_probe; the Samsung branch already declares its own inner status. Note Obj->String.Pointer may still be NULL inside the kept branch - that is the intended Samsung/EeePC path.)