From f4f3fd2ea4b878fe38fd3409f374ded8d5b34a4c Mon Sep 17 00:00:00 2001 From: Jian Ding Date: Wed, 20 May 2020 07:14:23 -0700 Subject: [PATCH] fix apsrintf return check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: 丁剑 Signed-off-by: Keith Busch --- nvme-topology.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvme-topology.c b/nvme-topology.c index e938f23..d24ef6b 100644 --- a/nvme-topology.c +++ b/nvme-topology.c @@ -357,9 +357,9 @@ static int verify_legacy_ns(struct nvme_namespace *n) char tmp_address[64] = ""; legacy_get_pci_bdf(path, tmp_address); if (tmp_address[0]) { - if (asprintf(&n->ctrl->transport, "pcie") != 1) + if (asprintf(&n->ctrl->transport, "pcie") < 0) return -1; - if (asprintf(&n->ctrl->address, "%s", tmp_address) != 1) + if (asprintf(&n->ctrl->address, "%s", tmp_address) < 0) return -1; } } -- 2.49.0