The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1a9ef1a3430036581b5a136091fc492bf2fa50ac
commit 1a9ef1a3430036581b5a136091fc492bf2fa50ac Author: John Baldwin <[email protected]> AuthorDate: 2026-01-20 20:42:55 +0000 Commit: John Baldwin <[email protected]> CommitDate: 2026-06-22 18:36:52 +0000 OFED: Use prandom_u32() to reduce diff with upstream Tested by: Wafa Hamzah <[email protected]> (mlx5_ib) Tested by: John Baldwin <[email protected]> (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)) {
