Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

librdmacm: Misc. fixes #1458

Merged
merged 2 commits into from
May 8, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
librdmacm: Fix an overflow bug in qsort comparison function
The comparison function dev_cmp() doesn't work with 64b pointers in some
cases, as it casts the pointer to int. For example it's not able to sort
this list:
  {0xfffe0c2f0b00, 0xaaac741b4a90, 0xaaac741b4d70}

Fixes: e5d371c ("librdmacm: Globally store and sort IB device list")
Signed-off-by: Mark Zhang <[email protected]>
Reviewed-by: Leon Romanovsky <[email protected]>
Signed-off-by: Yishai Hadas <[email protected]>
  • Loading branch information
MarkZhang81 authored and Yishai Hadas committed May 5, 2024
commit c4a5ac8bba611206e062c0955fb605bfc0f48b0f
2 changes: 1 addition & 1 deletion librdmacm/cma.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static void remove_cma_dev(struct cma_device *cma_dev)

static int dev_cmp(const void *a, const void *b)
{
return (int)(*(char *const *)a - *(char *const *)b);
return (*(uintptr_t *)a > *(uintptr_t *)b) - (*(uintptr_t *)a < *(uintptr_t *)b);
}

static int sync_devices_list(void)
Expand Down