Re: [PATCH v1 3/5] treewide: use get_random_u32() when possible

From
Jason Gunthorpe <jgg@ziepe.ca>
Date
2022-10-06 13:15:49
Also in
ceph-devel, dmaengine, dri-devel, linux-arm-kernel, linux-block, linux-crypto, linux-doc, linux-ext4, linux-f2fs-devel, linux-fbdev, linux-fsdevel, linux-hams, linux-media, linux-mm, linux-mmc, linux-nfs, linux-nvme, linux-raid, linux-rdma, linux-scsi, linux-sctp, linux-usb, linux-wireless, linux-xfs, lkml, lvs-devel, netdev, netfilter-devel, target-devel
Reply to
Jason A. Donenfeld, 2022-10-06
On Thu, Oct 06, 2022 at 07:05:48AM -0600, Jason A. Donenfeld wrote:
quoted
quoted
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index fd9d7f2c4d64..a605cf66b83e 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -465,7 +465,7 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id,
              goto err_qp;
      }

-     psn = prandom_u32() & 0xffffff;
+     psn = get_random_u32() & 0xffffff;
 prandom_max(0xffffff + 1)
That'd work, but again it's not more clear. Authors here are going for
a 24-bit number, and masking seems like a clear way to express that.
vs just asking directly for a 24 bit number?

Jason
Thread (31 messages) 31 messages, 8 authors, last reply 2022-10-13
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help