Patch "wifi: mac80211: avoid u32_encode_bits() warning" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    wifi: mac80211: avoid u32_encode_bits() warning

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     wifi-mac80211-avoid-u32_encode_bits-warning.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a939f0983e80c884fb3ab38c6e8e8dcbba1b5f70
Author: Arnd Bergmann <arnd@xxxxxxxx>
Date:   Tue Feb 14 14:20:21 2023 +0100

    wifi: mac80211: avoid u32_encode_bits() warning
    
    [ Upstream commit 1d8d4af4347420d657be448f8be4c39c558f3b5d ]
    
    gcc-9 triggers a false-postive warning in ieee80211_mlo_multicast_tx()
    for u32_encode_bits(ffs(links) - 1, ...), since ffs() can return zero
    on an empty bitmask, and the negative argument to u32_encode_bits()
    is then out of range:
    
    In file included from include/linux/ieee80211.h:21,
                     from include/net/cfg80211.h:23,
                     from net/mac80211/tx.c:23:
    In function 'u32_encode_bits',
        inlined from 'ieee80211_mlo_multicast_tx' at net/mac80211/tx.c:4437:17,
        inlined from 'ieee80211_subif_start_xmit' at net/mac80211/tx.c:4485:3:
    include/linux/bitfield.h:177:3: error: call to '__field_overflow' declared with attribute error: value doesn't fit into mask
      177 |   __field_overflow();     \
          |   ^~~~~~~~~~~~~~~~~~
    include/linux/bitfield.h:197:2: note: in expansion of macro '____MAKE_OP'
      197 |  ____MAKE_OP(u##size,u##size,,)
          |  ^~~~~~~~~~~
    include/linux/bitfield.h:200:1: note: in expansion of macro '__MAKE_OP'
      200 | __MAKE_OP(32)
          | ^~~~~~~~~
    
    Newer compiler versions do not cause problems with the zero argument
    because they do not consider this a __builtin_constant_p().
    It's also harmless since the hweight16() check already guarantees
    that this cannot be 0.
    
    Replace the ffs() with an equivalent find_first_bit() check that
    matches the later for_each_set_bit() style and avoids the warning.
    
    Fixes: 963d0e8d08d9 ("wifi: mac80211: optionally implement MLO multicast TX")
    Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
    Link: https://lore.kernel.org/r/20230214132025.1532147-1-arnd@xxxxxxxxxx
    Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 6409097a56c7a..55220e764de68 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4395,7 +4395,7 @@ static void ieee80211_mlo_multicast_tx(struct net_device *dev,
 	u32 ctrl_flags = IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX;
 
 	if (hweight16(links) == 1) {
-		ctrl_flags |= u32_encode_bits(ffs(links) - 1,
+		ctrl_flags |= u32_encode_bits(find_first_bit(&links, 16) - 1,
 					      IEEE80211_TX_CTRL_MLO_LINK);
 
 		__ieee80211_subif_start_xmit(skb, sdata->dev, 0, ctrl_flags,



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux