Skip to content

Commit

Permalink
contrib/rdmacm-mux: Fix error condition in hash_tbl_search_fd_by_ifid()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: AlexChen <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Marcel Apfelbaum <[email protected]>
Signed-off-by: Marcel Apfelbaum <[email protected]>
  • Loading branch information
AlexChen authored and marcel-apf committed Dec 18, 2020
1 parent a05f8ec commit eed31bc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/rdmacm-mux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit eed31bc

Please sign in to comment.