Check cpu_softc is not NULL before dereferencing

In the acpi_cpu_postattach SYSINIT function cpu_softc may be NULL, e.g.
on arm64 when booting from FDT. Check it is not NULL at the start of
the function so we don't try to dereference a NULL pointer.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Andrew Turner 2021-09-27 12:22:15 +01:00
parent 74237127e3
commit 4e50efb194

View File

@ -444,6 +444,9 @@ acpi_cpu_postattach(void *unused __unused)
struct acpi_cpu_softc *sc;
int attached = 0, i;
if (cpu_softc == NULL)
return;
mtx_lock(&Giant);
CPU_FOREACH(i) {
if ((sc = cpu_softc[i]) != NULL)