Skip to contentSkip to conversation

wifi: ipw2x00: fix bad alignments

PATCH Superseded Jiapeng Chong 3 participants 4 messages Nov 1, 2024 Intel pro/wireless 2100, 2200BG, 2915ABG network connection support

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wifi: ipw2x00: fix bad alignments

This patch fixes incorrect code alignment.

./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882. ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.

---
Changes in v2:
-Replace the & in the if statement with &&. Add 'wifi: ' to subject.

 .../net/wireless/intel/ipw2x00/libipw_rx.c    | 44 +++++++++----------
 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/net/wireless/intel/ipw2x00/libipw_rx.c +22 -22
index 7e41cb7bbfe0..38731f67cb54 100644
@@ -868,34 +868,34 @@ void libipw_rx_any(struct libipw_device *ieee,
 	case IW_MODE_ADHOC:
 		/* our BSS and not from/to DS */
 		if (ether_addr_equal(hdr->addr3, ieee->bssid))
-		if ((fc & (IEEE80211_FCTL_TODS+IEEE80211_FCTL_FROMDS)) == 0) {
-			/* promisc: get all */
-			if (ieee->dev->flags & IFF_PROMISC)
-				is_packet_for_us = 1;
-			/* to us */
-			else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
-				is_packet_for_us = 1;
-			/* mcast */
-			else if (is_multicast_ether_addr(hdr->addr1))
-				is_packet_for_us = 1;
+			if ((fc && (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == 0) {
+				/* promisc: get all */
+				if (ieee->dev->flags & IFF_PROMISC)
+					is_packet_for_us = 1;
+				/* to us */
+				else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
+					is_packet_for_us = 1;
+				/* mcast */
+				else if (is_multicast_ether_addr(hdr->addr1))
+					is_packet_for_us = 1;
 		}
 		break;
 	case IW_MODE_INFRA:
 		/* our BSS (== from our AP) and from DS */
 		if (ether_addr_equal(hdr->addr2, ieee->bssid))
-		if ((fc & (IEEE80211_FCTL_TODS+IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS) {
-			/* promisc: get all */
-			if (ieee->dev->flags & IFF_PROMISC)
-				is_packet_for_us = 1;
-			/* to us */
-			else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
-				is_packet_for_us = 1;
-			/* mcast */
-			else if (is_multicast_ether_addr(hdr->addr1)) {
-				/* not our own packet bcasted from AP */
-				if (!ether_addr_equal(hdr->addr3, ieee->dev->dev_addr))
+			if ((fc && (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == IEEE80211_FCTL_FROMDS) {
+				/* promisc: get all */
+				if (ieee->dev->flags & IFF_PROMISC)
 					is_packet_for_us = 1;
-			}
+				/* to us */
+				else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
+					is_packet_for_us = 1;
+				/* mcast */
+				else if (is_multicast_ether_addr(hdr->addr1)) {
+					/* not our own packet bcasted from AP */
+					if (!ether_addr_equal(hdr->addr3, ieee->dev->dev_addr))
+						is_packet_for_us = 1;
+				}
 		}
 		break;
 	default:
Signature · 1 line
2.32.0.3.g01195cf9f
#1 lore raw
Quoted 11 lines · Jiapeng Chong

This patch fixes incorrect code alignment.

./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882. ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.

---
Changes in v2:
-Replace the & in the if statement with &&.

I feel what Kalle meant is like this:

if (ether_addr_equal(hdr->addr3, ieee->bssid) &&

    (fc & (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == 0)
#2 lore raw
Quoted 15 lines · Ping-Ke Shih
Quoted 7 lines · Jiapeng Chong

This patch fixes incorrect code alignment.

./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882. ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.

Quoted 6 lines

---
Changes in v2:
-Replace the & in the if statement with &&.

Quoted 4 lines

I feel what Kalle meant is like this:

if (ether_addr_equal(hdr->addr3, ieee->bssid) &&

    (fc & (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == 0)

Exactly, thanks Ping.

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

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw
In reply to Jiapeng Chong
Quoted 24 lines · Jiapeng Chong

This patch fixes incorrect code alignment.

./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:871:2-3: code aligned with following code on line 882. ./drivers/net/wireless/intel/ipw2x00/libipw_rx.c:886:2-3: code aligned with following code on line 900.

---
Changes in v2:
-Replace the & in the if statement with &&. Add 'wifi: ' to subject.

 .../net/wireless/intel/ipw2x00/libipw_rx.c    | 44 +++++++++----------
 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/net/wireless/intel/ipw2x00/libipw_rx.c +0 -1
index 7e41cb7bbfe0..38731f67cb54 100644
@@ -868,34 +868,34 @@ void libipw_rx_any(struct libipw_device *ieee,
 	case IW_MODE_ADHOC:
 		/* our BSS and not from/to DS */
 		if (ether_addr_equal(hdr->addr3, ieee->bssid))
-		if ((fc & (IEEE80211_FCTL_TODS+IEEE80211_FCTL_FROMDS)) == 0) {

drivers/net/wireless/intel/ipw2x00/libipw_rx.c void libipw_rx_any(struct libipw_device *ieee, · line 871

Quoted 10 lines
drivers/net/wireless/intel/ipw2x00/libipw_rx.c +1 -9
-			/* promisc: get all */
-			if (ieee->dev->flags & IFF_PROMISC)
-				is_packet_for_us = 1;
-			/* to us */
-			else if (ether_addr_equal(hdr->addr1, ieee->dev->dev_addr))
-				is_packet_for_us = 1;
-			/* mcast */
-			else if (is_multicast_ether_addr(hdr->addr1))
-				is_packet_for_us = 1;
+			if ((fc && (IEEE80211_FCTL_TODS + IEEE80211_FCTL_FROMDS)) == 0) {

I meant instead of using two nested if statements you can use only one if statement with '&&' operator.

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

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