Re: [PATCH v6 5/7] treewide: use get_random_u32() when possible

From: Jason A. Donenfeld
Date: Tue Oct 11 2022 - 15:20:56 EST


On Tue, Oct 11, 2022 at 11:14:44AM +0200, Rolf Eike Beer wrote:
> Am Dienstag, 11. Oktober 2022, 01:06:11 CEST schrieb Jason A. Donenfeld:
> > 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. The same also applies to get_random_int(), which is
> > just a wrapper around get_random_u32(). This was done as a basic find
> > and replace.
>
> > diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
> > b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c index
> > d0a7465be586..3a7aded30e8e 100644
> > --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
> > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c
> > @@ -177,7 +177,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp,
> > struct brcmf_pno_info *pi) memcpy(pfn_mac.mac, mac_addr, ETH_ALEN);
> > for (i = 0; i < ETH_ALEN; i++) {
> > pfn_mac.mac[i] &= mac_mask[i];
> > - pfn_mac.mac[i] |= get_random_int() & ~(mac_mask[i]);
> > + pfn_mac.mac[i] |= get_random_u32() & ~(mac_mask[i]);
> > }
> > /* Clear multi bit */
> > pfn_mac.mac[0] &= 0xFE;
>
> mac is defined as u8 mac[ETH_ALEN]; in fwil_types.h.
>
> Eike
>
> P.S.: CC list trimmed because of an unrelated mailer bug

Nice catch, thanks. Will remove to the get_random_{u16,u8} commit.