git: 1a9ef1a34300 - main - OFED: Use prandom_u32() to reduce diff with upstream
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 22 Jun 2026 18:37:50 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=1a9ef1a3430036581b5a136091fc492bf2fa50ac
commit 1a9ef1a3430036581b5a136091fc492bf2fa50ac
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2026-01-20 20:42:55 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2026-06-22 18:36:52 +0000
OFED: Use prandom_u32() to reduce diff with upstream
Tested by: Wafa Hamzah <wafah@nvidia.com> (mlx5_ib)
Tested by: John Baldwin <jhb@FreeBSD.org> (iw_cxgbe)
Sponsored by: Chelsio Communications
---
sys/ofed/drivers/infiniband/core/ib_cma.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sys/ofed/drivers/infiniband/core/ib_cma.c b/sys/ofed/drivers/infiniband/core/ib_cma.c
index 44783cbf8362..43f0e4c7bb32 100644
--- a/sys/ofed/drivers/infiniband/core/ib_cma.c
+++ b/sys/ofed/drivers/infiniband/core/ib_cma.c
@@ -3219,12 +3219,10 @@ static int cma_alloc_any_port(enum rdma_port_space ps,
int low, high, remaining;
unsigned int rover;
struct vnet *net = id_priv->id.route.addr.dev_addr.net;
- u32 rand;
inet_get_local_port_range(net, &low, &high);
remaining = (high - low) + 1;
- get_random_bytes(&rand, sizeof(rand));
- rover = rand % remaining + low;
+ rover = prandom_u32() % remaining + low;
retry:
if (last_used_port != rover &&
!cma_ps_find(net, ps, (unsigned short)rover)) {