]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: info: fix bug reading preambles and bandwidths
authorJaewan Kim <jaewan@google.com>
Mon, 9 Jan 2023 15:14:55 +0000 (00:14 +0900)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 12 Jan 2023 10:02:41 +0000 (11:02 +0100)
Preambles and bandwidths values are considered as bit shifts
when they're are used for capabilities.

Signed-off-by: Jaewan Kim <jaewan@google.com>
Link: https://lore.kernel.org/r/20230109151455.325793-1-jaewan@google.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
info.c

diff --git a/info.c b/info.c
index eb257f8846876bcff1ad5649ce12591c7781d41b..5229d446e13eccce61741136dbfd439970e3da8c 100644 (file)
--- a/info.c
+++ b/info.c
@@ -197,7 +197,7 @@ static void __print_ftm_capability(struct nlattr *ftm_capa)
        if (tb[NL80211_PMSR_FTM_CAPA_ATTR_PREAMBLES]) {
 #define PRINT_PREAMBLE(P, V) \
        do { \
-               if (P | NL80211_PREAMBLE_##V) \
+               if (P & BIT(NL80211_PREAMBLE_##V)) \
                        printf(" " #V); \
        } while (0)
 
@@ -215,7 +215,7 @@ static void __print_ftm_capability(struct nlattr *ftm_capa)
        if (tb[NL80211_PMSR_FTM_CAPA_ATTR_BANDWIDTHS]) {
 #define PRINT_BANDWIDTH(B, V) \
        do { \
-               if (B | NL80211_CHAN_WIDTH_##V) \
+               if (B & BIT(NL80211_CHAN_WIDTH_##V)) \
                        printf(" " #V); \
        } while (0)