linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
  • * Re: [PATCH v1 3/5] treewide: use get_random_u32() when possible
           [not found] ` <20221005214844.2699-4-Jason@zx2c4.com>
           [not found]   ` <Yz7OdfKZeGkpZSKb@ziepe.ca>
    @ 2022-10-12 19:16   ` Joe Perches
      2022-10-12 21:29     ` David Laight
      1 sibling, 1 reply; 5+ messages in thread
    From: Joe Perches @ 2022-10-12 19:16 UTC (permalink / raw)
      To: Jason A. Donenfeld, linux-kernel
      Cc: brcm80211-dev-list.pdl, cake, ceph-devel, coreteam, dccp, dev,
    	dmaengine, drbd-dev, dri-devel, kasan-dev, linux-actions,
    	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-mtd,
    	linux-nfs, linux-nvme, linux-raid, linux-rdma, linux-scsi,
    	linux-sctp, linux-stm32, linux-usb, linux-wireless, linux-xfs,
    	linuxppc-dev, lvs-devel, netdev, netfilter-devel, rds-devel,
    	SHA-cyfmac-dev-list, target-devel, tipc-discussion
    
    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);
    
    
    _______________________________________________
    linux-arm-kernel mailing list
    linux-arm-kernel@lists.infradead.org
    http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
    
    ^ permalink raw reply	[flat|nested] 5+ messages in thread

  • end of thread, other threads:[~2022-10-13  1:38 UTC | newest]
    
    Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
    -- links below jump to the message on this page --
         [not found] <20221005214844.2699-1-Jason@zx2c4.com>
         [not found] ` <20221005214844.2699-4-Jason@zx2c4.com>
         [not found]   ` <Yz7OdfKZeGkpZSKb@ziepe.ca>
         [not found]     ` <CAHmME9r_vNRFFjUvqx8QkBddg_kQU=FMgpk9TqOVZdvX6zXHNg@mail.gmail.com>
    2022-10-06 13:15       ` [PATCH v1 3/5] treewide: use get_random_u32() when possible Jason Gunthorpe
    2022-10-06 13:20       ` Andy Shevchenko
    2022-10-12 19:16   ` Joe Perches
    2022-10-12 21:29     ` David Laight
    2022-10-13  1:37       ` Joe Perches
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox;
    as well as URLs for NNTP newsgroup(s).