nexus: Avoid NULL pointer access

This commit is contained in:
Sebastian Huber 2019-07-18 10:23:31 +02:00
parent 329cf5c013
commit bd6b20c0e6

View File

@ -174,7 +174,10 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
}
SET_FOREACH(nd, nexus) {
if (strcmp(device_get_name(child), nd->name) == 0
const char *name;
name = device_get_name(child);
if (name != NULL && strcmp(name, nd->name) == 0
&& device_get_unit(child) == nd->unit) {
if (nexus_get_start(nd, type, &start)) {
res = rman_reserve_resource(rm, start, end,