On Mon, 2019-02-11 at 16:57 +0200, Jouni Malinen wrote:
> On Sat, Feb 09, 2019 at 09:08:20AM +0100, Johannes Berg wrote:
> 
> > but maybe the whole thing is more readable as
> > 
> > static inline void cfg80211_gen_new_bssid(const u8 *bssid_addr, u8 
> > max_bssid,
> >                                           u8 mbssid_index, u8 
> > *new_bssid_addr)
> > {
> >         u64 bssid = ether_addr_to_u64(bssid_addr);
> >         u64 mask = GENMASK_ULL(max_bssid - 1, 0);
> >         u64 new_bssid;
> > 
> >         new_bssid &= bssid & ~mask;
> 
> That should be "=" not "&="..

Yes, good point.

> > However, isn't it true that 0 <= mbssid_index < max_bssid? Then the
> > whole masking isn't really needed at all?
> 
> 0 <= mbssid_index < 2^max_bssid. 

True, sorry.

> The transmitted BSSID (i.e., that
> bssid_addr argument) is not required to be the first BSSID in the range,
> so the masking is needed to cover wraparound for addition modulo
> 2^mbssid_index when max_bssid LSBs of bssid are not zeros.

Ah ok.

Alright, I'll send out a proper patch.

Thanks!

johannes

Reply via email to