From eed31bc5e2e9cc68626d51e7a10914dc52c370f8 Mon Sep 17 00:00:00 2001 From: AlexChen Date: Thu, 29 Oct 2020 21:43:27 +0800 Subject: [PATCH] contrib/rdmacm-mux: Fix error condition in hash_tbl_search_fd_by_ifid() When fd is not found according to ifid, the _hash_tbl_search_fd_by_ifid() returns 0 and assigns the result to *fd, so We have to check that *fd is 0, not that fd is 0. Reported-by: Euler Robot Signed-off-by: AlexChen Message-Id: <5F9AC6FF.4000301@huawei.com> Reviewed-by: Marcel Apfelbaum Signed-off-by: Marcel Apfelbaum --- contrib/rdmacm-mux/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/rdmacm-mux/main.c b/contrib/rdmacm-mux/main.c index bd82abbad3..771ca01e03 100644 --- a/contrib/rdmacm-mux/main.c +++ b/contrib/rdmacm-mux/main.c @@ -186,7 +186,7 @@ static int hash_tbl_search_fd_by_ifid(int *fd, __be64 *gid_ifid) *fd = _hash_tbl_search_fd_by_ifid(gid_ifid); pthread_rwlock_unlock(&server.lock); - if (!fd) { + if (!*fd) { syslog(LOG_WARNING, "Can't find matching for ifid 0x%llx\n", *gid_ifid); return -ENOENT; }