Skip to contentSkip to conversation

iw: info: fix bug reading preamble and bandwidths

PATCH Superseded Jaewan Kim 2 participants 7 messages Dec 20, 2022 – Jan 9, 2023

lore
Share & tools
lore

Jaewan Kim

author
#0 lore raw

PATCH 1/1 iw: info: fix bug reading preamble and bandwidths

---
 info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
info.c +2 -2
index eb257f8..98461a4 100644
@@ -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)
 
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
author
#1 lore raw

PATCH v2 1/1 iw: info: fix bug reading preamble and bandwidths

---
 info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
info.c +2 -2
index eb257f8..5229d44 100644
@@ -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)
 
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#2 lore raw
Quoted 1 line · Jaewan Kim

Empty commit logs are frowned upon. Even if the bug is simple there should be a some kind of commit log.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author
#3 lore raw

PATCH v3 1/1 iw: info: fix bug reading preambles and bandwidths

In reply to Jaewan Kim

Preambles and bandwidths values are considered as bit shifts when they're are used for capabilities.

---
 info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
info.c +2 -2
index eb257f8..5229d44 100644
@@ -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)
 
Signature · 1 line
2.39.0.314.g84b9a713c41-goog
#4 lore raw

Re: [PATCH v3] iw: info: fix bug reading preambles and bandwidths

Quoted 5 lines · Jaewan Kim

Preambles and bandwidths values are considered as bit shifts when they're are used for capabilities.

I didn't provide you a Reviewed-by tag[1] during my review, please don't create such tags yourself. For example, in this case I didn't review the patch in detail so I'm not comfortable giving you my Reviewed-by tag.

The general idea is that you only copy paste the tag when someone gives you one, you don't create them on your own. I think Reported-by is only exception but there might be others.

[1] https://lore.kernel.org/linux-wireless/[email protected]/

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author
#5 lore raw

Re: [PATCH v3] iw: info: fix bug reading preambles and bandwidths

Quoted 17 lines · Kalle Valo
Quoted 5 lines · Jaewan Kim

Preambles and bandwidths values are considered as bit shifts when they're are used for capabilities.

I didn't provide you a Reviewed-by tag[1] during my review, please don't create such tags yourself. For example, in this case I didn't review the patch in detail so I'm not comfortable giving you my Reviewed-by tag.

The general idea is that you only copy paste the tag when someone gives you one, you don't create them on your own. I think Reported-by is only exception but there might be others.

Quoted 6 lines

[1] https://lore.kernel.org/linux-wireless/[email protected]/

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Sorry about the newbie mistake. Let me remove the line as you advised.

Signature · 2 lines
Jaewan Kim (김재완) | Software Engineer in Google Korea |
[email protected] | +82-10-2781-5078
author
#6 lore raw

PATCH v4 1/1 iw: info: fix bug reading preambles and bandwidths

In reply to Jaewan Kim

Preambles and bandwidths values are considered as bit shifts when they're are used for capabilities.

---
 info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
info.c +2 -2
index eb257f8..5229d44 100644
@@ -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)
 
Signature · 1 line
2.39.0.314.g84b9a713c41-goog