Skip to content

Commit 3d331e1

Browse files
authored
Merge pull request #1439 from linux-nvme/fix-scan_subsystem
nvme-topology: Check if state variable is a valid string
2 parents 1264c63 + f6eb85f commit 3d331e1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nvme-topology.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,9 @@ static int scan_subsystem(struct nvme_subsystem *s, __u32 ns_instance, int nsid)
384384
n->name = strdup(ns[i]->d_name);
385385
for (j = 0; j < s->nr_ctrls; j++) {
386386
n->ctrl = &s->ctrls[j];
387-
if (!strcmp(n->ctrl->state, "live") &&
388-
!scan_namespace(n))
387+
if (n->ctrl->state &&
388+
!strcmp(n->ctrl->state, "live") &&
389+
!scan_namespace(n))
389390
break;
390391
}
391392
}

0 commit comments

Comments
 (0)