Skip to contentSkip to conversation

netdev: allow empty TX/RX bitrate attributes

PATCH Applied James Prestwood 2 participants 2 messages Sep 20, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 netdev: allow empty TX/RX bitrate attributes

The TX or RX bitrate attributes can contain zero nested attributes. This causes netdev_parse_bitrate() to fail, but this shouldn't then cause the overall parsing to fail (we just don't have those values).

Fix this by continuing to parse attributes if either the TX/RX bitrates fail to parse.

---
 src/netdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

v2:
* Retain the other "return false" lines as these do indicate some kind of kernel bug if the lengths don't match up to expected.

src/netdev.c +2 -2
index d95a2a1e..1e923805 100644
@@ -602,7 +602,7 @@ static bool netdev_parse_sta_info(struct l_genl_attr *attr,
 			if (!netdev_parse_bitrate(&nested, &info->rx_mcs_type,
 							&info->rx_bitrate,
 							&info->rx_mcs))
-				return false;
+				continue;
 
 			info->have_rx_bitrate = true;
 
@@ -618,7 +618,7 @@ static bool netdev_parse_sta_info(struct l_genl_attr *attr,
 			if (!netdev_parse_bitrate(&nested, &info->tx_mcs_type,
 							&info->tx_bitrate,
 							&info->tx_mcs))
-				return false;
+				continue;
 
 			info->have_tx_bitrate = true;
 
Signature · 1 line
2.34.1
#1 lore raw

Hi James,

Quoted 6 lines · James Prestwood

The TX or RX bitrate attributes can contain zero nested attributes. This causes netdev_parse_bitrate() to fail, but this shouldn't then cause the overall parsing to fail (we just don't have those values).

Fix this by continuing to parse attributes if either the TX/RX bitrates fail to parse.

Quoted 8 lines
---
  src/netdev.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

v2:
* Retain the other "return false" lines as these do indicate some kind of kernel bug if the lengths don't match up to expected.

Applied, thanks.

Regards,
-Denis