]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
libnvme : record the nvme pci adapter physical slot
authorNilay Shroff <nilay@linux.ibm.com>
Thu, 21 Mar 2024 13:16:17 +0000 (18:46 +0530)
committerDaniel Wagner <dwagner@suse.de>
Thu, 21 Mar 2024 13:47:33 +0000 (14:47 +0100)
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 <nilay@linux.ibm.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
src/nvme/tree.c

index de6ce8799ad7435cb25166f950be9291bdc6af5b..584e3f6afa0d2e55dbd6b1cb71a61802bc293839 100644 (file)
@@ -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) {