Skip to content

Commit 49a4cd8

Browse files
gjoyce-ibmigaw
authored andcommitted
tree: handle no address phy slot dirs
Not all directories have an address. Verify addr before calling strcmp(). Fixes: 42ac453 ("tree: Add PCI physical slot number for controller") Signed-off-by: Greg Joyce <[email protected]>
1 parent f54a1fe commit 49a4cd8

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/nvme/tree.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,10 @@ static char *nvme_ctrl_lookup_phy_slot(nvme_root_t r, const char *address)
18671867
return NULL;
18681868
}
18691869
addr = nvme_get_attr(path, "address");
1870+
1871+
/* some directories don't have an address entry */
1872+
if (!addr)
1873+
continue;
18701874
if (strcmp(addr, target_addr) == 0)
18711875
return strdup(entry->d_name);
18721876
}

0 commit comments

Comments
 (0)