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

From: Chuck Lever III
Date: Thu Oct 06 2022 - 11:46:22 EST




> On Oct 6, 2022, at 9:25 AM, Jason A. Donenfeld <Jason@xxxxxxxxx> 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.
>
> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>
> Signed-off-by: Jason A. Donenfeld <Jason@xxxxxxxxx>
> ---
> Documentation/networking/filter.rst | 2 +-
> drivers/infiniband/hw/cxgb4/cm.c | 4 ++--
> drivers/infiniband/hw/hfi1/tid_rdma.c | 2 +-
> drivers/infiniband/hw/mlx4/mad.c | 2 +-
> drivers/infiniband/ulp/ipoib/ipoib_cm.c | 2 +-
> drivers/md/raid5-cache.c | 2 +-
> drivers/mtd/nand/raw/nandsim.c | 2 +-
> drivers/net/bonding/bond_main.c | 2 +-
> drivers/net/ethernet/broadcom/cnic.c | 2 +-
> .../chelsio/inline_crypto/chtls/chtls_cm.c | 2 +-
> drivers/net/ethernet/rocker/rocker_main.c | 6 +++---
> .../net/wireless/marvell/mwifiex/cfg80211.c | 4 ++--
> .../net/wireless/microchip/wilc1000/cfg80211.c | 2 +-
> .../net/wireless/quantenna/qtnfmac/cfg80211.c | 2 +-
> drivers/nvme/common/auth.c | 2 +-
> drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 4 ++--
> drivers/target/iscsi/cxgbit/cxgbit_cm.c | 2 +-
> drivers/thunderbolt/xdomain.c | 2 +-
> drivers/video/fbdev/uvesafb.c | 2 +-
> fs/exfat/inode.c | 2 +-
> fs/ext4/ialloc.c | 2 +-
> fs/ext4/ioctl.c | 4 ++--
> fs/ext4/mmp.c | 2 +-
> fs/f2fs/namei.c | 2 +-
> fs/fat/inode.c | 2 +-
> fs/nfsd/nfs4state.c | 4 ++--
> fs/ubifs/journal.c | 2 +-
> fs/xfs/libxfs/xfs_ialloc.c | 2 +-
> fs/xfs/xfs_icache.c | 2 +-
> fs/xfs/xfs_log.c | 2 +-
> include/net/netfilter/nf_queue.h | 2 +-
> include/net/red.h | 2 +-
> include/net/sock.h | 2 +-
> kernel/kcsan/selftest.c | 2 +-
> lib/random32.c | 2 +-
> lib/reed_solomon/test_rslib.c | 6 +++---
> lib/test_fprobe.c | 2 +-
> lib/test_kprobes.c | 2 +-
> lib/test_rhashtable.c | 6 +++---
> mm/shmem.c | 2 +-
> net/802/garp.c | 2 +-
> net/802/mrp.c | 2 +-
> net/core/pktgen.c | 4 ++--
> net/ipv4/tcp_cdg.c | 2 +-
> net/ipv4/udp.c | 2 +-
> net/ipv6/ip6_flowlabel.c | 2 +-
> net/ipv6/output_core.c | 2 +-
> net/netfilter/ipvs/ip_vs_conn.c | 2 +-
> net/netfilter/xt_statistic.c | 2 +-
> net/openvswitch/actions.c | 2 +-
> net/rds/bind.c | 2 +-
> net/sched/sch_cake.c | 2 +-
> net/sched/sch_netem.c | 18 +++++++++---------
> net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 ++--
> net/sunrpc/xprt.c | 2 +-
> net/unix/af_unix.c | 2 +-
> 56 files changed, 77 insertions(+), 77 deletions(-)

...


> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index c5d199d7e6b4..e10c16cd7881 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -4346,8 +4346,8 @@ void nfsd4_init_leases_net(struct nfsd_net *nn)
> nn->nfsd4_grace = 90;
> nn->somebody_reclaimed = false;
> nn->track_reclaim_completes = false;
> - nn->clverifier_counter = prandom_u32();
> - nn->clientid_base = prandom_u32();
> + nn->clverifier_counter = get_random_u32();
> + nn->clientid_base = get_random_u32();
> nn->clientid_counter = nn->clientid_base + 1;
> nn->s2s_cp_cl_id = nn->clientid_counter++;
>

For the NFSD hunk:

Acked-by: Chuck Lever <chuck.lever@xxxxxxxxxx>

--
Chuck Lever