acpi_ibm.ko panics if SMBIOS information is not available

Add a check for NULL before strcmp on smbios information incase it is not populated

Differential Revision:	https://reviews.freebsd.org/D2750
Reviewed by:	ngie, jhb
Approved by:	rpaulo
Sponsored by:	ScaleEngine Inc.
This commit is contained in:
allanjude 2015-06-13 05:55:26 +00:00
parent 711a6b1e7a
commit e8f8dbdb39

View File

@ -485,6 +485,9 @@ acpi_ibm_attach(device_t dev)
/* Enable per-model events. */
maker = kern_getenv("smbios.system.maker");
product = kern_getenv("smbios.system.product");
if (maker != NULL && product != NULL)
goto nosmbios;
for (i = 0; i < nitems(acpi_ibm_models); i++) {
if (strcmp(maker, acpi_ibm_models[i].maker) == 0 &&
strcmp(product, acpi_ibm_models[i].product) == 0) {
@ -494,6 +497,8 @@ acpi_ibm_attach(device_t dev)
ACPI_SERIAL_END(ibm);
}
}
nosmbios:
freeenv(maker);
freeenv(product);