All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: alex.chen@huawei.com, yuval.shaia.ml@gmail.com, euler.robot@huawei.com
Subject: [Qemu-devel] [PULL 1/1] contrib/rdmacm-mux: Fix error condition in hash_tbl_search_fd_by_ifid()
Date: Fri, 18 Dec 2020 21:00:22 +0200	[thread overview]
Message-ID: <20201218190022.31214-2-marcel.apfelbaum@gmail.com> (raw)
In-Reply-To: <20201218190022.31214-1-marcel.apfelbaum@gmail.com>

From: AlexChen <alex.chen@huawei.com>

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 <euler.robot@huawei.com>
Signed-off-by: AlexChen <alex.chen@huawei.com>
Message-Id: <5F9AC6FF.4000301@huawei.com>
Reviewed-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
---
 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;
     }
-- 
2.17.2



  reply	other threads:[~2020-12-18 19:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-18 19:00 [Qemu-devel] [PULL 0/1] RDMA queue Marcel Apfelbaum
2020-12-18 19:00 ` Marcel Apfelbaum [this message]
2021-01-01 14:32 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201218190022.31214-2-marcel.apfelbaum@gmail.com \
    --to=marcel.apfelbaum@gmail.com \
    --cc=alex.chen@huawei.com \
    --cc=euler.robot@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=yuval.shaia.ml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.