lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <f8ad3ba44d28dec1a5f7626b82c5e9c2aeefa729.camel@perches.com> Date: Wed, 12 Oct 2022 12:16:53 -0700 From: Joe Perches <joe@...ches.com> To: "Jason A. Donenfeld" <Jason@...c4.com>, linux-kernel@...r.kernel.org Cc: brcm80211-dev-list.pdl@...adcom.com, cake@...ts.bufferbloat.net, ceph-devel@...r.kernel.org, coreteam@...filter.org, dccp@...r.kernel.org, dev@...nvswitch.org, dmaengine@...r.kernel.org, drbd-dev@...ts.linbit.com, dri-devel@...ts.freedesktop.org, kasan-dev@...glegroups.com, linux-actions@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org, linux-block@...r.kernel.org, linux-crypto@...r.kernel.org, linux-doc@...r.kernel.org, linux-ext4@...r.kernel.org, linux-f2fs-devel@...ts.sourceforge.net, linux-fbdev@...r.kernel.org, linux-fsdevel@...r.kernel.org, linux-hams@...r.kernel.org, linux-media@...r.kernel.org, linux-mm@...ck.org, linux-mmc@...r.kernel.org, linux-mtd@...ts.infradead.org, linux-nfs@...r.kernel.org, linux-nvme@...ts.infradead.org, linux-raid@...r.kernel.org, linux-rdma@...r.kernel.org, linux-scsi@...r.kernel.org, linux-sctp@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com, linux-usb@...r.kernel.org, linux-wireless@...r.kernel.org, linux-xfs@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org, lvs-devel@...r.kernel.org, netdev@...r.kernel.org, netfilter-devel@...r.kernel.org, rds-devel@....oracle.com, SHA-cyfmac-dev-list@...ineon.com, target-devel@...r.kernel.org, tipc-discussion@...ts.sourceforge.net Subject: Re: [PATCH v1 3/5] treewide: use get_random_u32() when possible On Wed, 2022-10-05 at 23:48 +0200, Jason A. Donenfeld wrote: > The prandom_u32() function has been a deprecated inline wrapper around > get_random_u32() for several releases now, and compiles down to the > exact same code. Replace the deprecated wrapper with a direct call to > the real function. [] > diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c [] > @@ -734,7 +734,7 @@ static int send_connect(struct c4iw_ep *ep) > &ep->com.remote_addr; > int ret; > enum chip_type adapter_type = ep->com.dev->rdev.lldi.adapter_type; > - u32 isn = (prandom_u32() & ~7UL) - 1; > + u32 isn = (get_random_u32() & ~7UL) - 1; trivia: There are somewhat odd size mismatches here. I had to think a tiny bit if random() returned a value from 0 to 7 and was promoted to a 64 bit value then truncated to 32 bit. Perhaps these would be clearer as ~7U and not ~7UL > struct net_device *netdev; > u64 params; > > @@ -2469,7 +2469,7 @@ static int accept_cr(struct c4iw_ep *ep, struct sk_buff *skb, > } > > if (!is_t4(adapter_type)) { > - u32 isn = (prandom_u32() & ~7UL) - 1; > + u32 isn = (get_random_u32() & ~7UL) - 1; etc... drivers/infiniband/hw/cxgb4/cm.c: u32 isn = (prandom_u32() & ~7UL) - 1; drivers/infiniband/hw/cxgb4/cm.c: u32 isn = (prandom_u32() & ~7UL) - 1; drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_cm.c: rpl5->iss = cpu_to_be32((prandom_u32() & ~7UL) - 1); drivers/scsi/cxgbi/cxgb4i/cxgb4i.c: u32 isn = (prandom_u32() & ~7UL) - 1; drivers/scsi/cxgbi/cxgb4i/cxgb4i.c: u32 isn = (prandom_u32() & ~7UL) - 1; drivers/target/iscsi/cxgbit/cxgbit_cm.c: rpl5->iss = cpu_to_be32((prandom_u32() & ~7UL) - 1);
Powered by blists - more mailing lists