From ea5600c843080db45590b5997176cc13d7a290bb Mon Sep 17 00:00:00 2001 From: Nilay Shroff Date: Thu, 21 Mar 2024 18:46:17 +0530 Subject: [PATCH] libnvme : record the nvme pci adapter physical slot There is a subtle bug in the nvme controller physical slot lookup code due to which the readdir() prematurely aborts the lookup and hence libnvme fails to record the pci slot address of the nvme controller. This patch helps to fix this issue. Signed-off-by: Nilay Shroff Signed-off-by: Daniel Wagner --- src/nvme/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvme/tree.c b/src/nvme/tree.c index de6ce879..584e3f6a 100644 --- a/src/nvme/tree.c +++ b/src/nvme/tree.c @@ -1729,7 +1729,7 @@ static char *nvme_ctrl_lookup_phy_slot(nvme_root_t r, const char *address) } target_addr = strndup(address, 10); - while (!(entry = readdir(slots_dir))) { + while ((entry = readdir(slots_dir))) { if (entry->d_type == DT_DIR && strncmp(entry->d_name, ".", 1) != 0 && strncmp(entry->d_name, "..", 2) != 0) { -- 2.50.1