From: Daniel Wagner Date: Thu, 22 Jun 2023 12:09:50 +0000 (+0200) Subject: tree: Ignore NULL address pointer for phy slot lookup X-Git-Tag: v1.5~11 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=fa2ab270cba31f4523277f9c74d572caff6a42d4;p=users%2Fsagi%2Flibnvme.git tree: Ignore NULL address pointer for phy slot lookup The PCI physical slot lookup works obviously only for physical cards. Thus do not try to dereference the address pointer if it is a NULL pointer. Fixes: 42ac45359635 ("tree: Add PCI physical slot number for controller") Signed-off-by: Daniel Wagner --- diff --git a/src/nvme/tree.c b/src/nvme/tree.c index 4ba39832..a2ac0698 100644 --- a/src/nvme/tree.c +++ b/src/nvme/tree.c @@ -1274,6 +1274,9 @@ static char *nvme_ctrl_lookup_phy_slot(nvme_root_t r, const char *address) DIR *slots_dir; struct dirent *entry; + if (!address) + return NULL; + slots_dir = opendir(nvme_slots_sysfs_dir); if (!slots_dir) { nvme_msg(r, LOG_WARNING, "failed to open slots dir %s\n",