From: Hannes Reinecke Date: Fri, 21 Jan 2022 07:17:34 +0000 (+0100) Subject: nvme-print: check namespace in nvme_ctrl_for_each_path() X-Git-Tag: v2.0-rc1~9^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=548d9cdd6503fc284f9b78a843ef6ba23f6387da;p=users%2Fsagi%2Fnvme-cli.git nvme-print: check namespace in nvme_ctrl_for_each_path() We should check if the namespace is available when scanning all paths in nvme_ctrl_for_each_path(); a controller might be resetting and might not be able to access the namespaces here. Signed-off-by: Hannes Reinecke --- diff --git a/nvme-print.c b/nvme-print.c index 894d2571..6c682fbe 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -6704,8 +6704,11 @@ static void nvme_show_detailed_list(nvme_root_t r) } nvme_ctrl_for_each_path(c, p) { + n = nvme_path_get_ns(p); + if (!n) + continue; printf("%s%s", first ? "": ", ", - nvme_ns_get_name(nvme_path_get_ns(p))); + nvme_ns_get_name(n)); first = false; } printf("\n");