public inbox for iwd@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v2] netdev: allow empty TX/RX bitrate attributes
@ 2024-09-20 13:55 James Prestwood
  2024-09-20 15:27 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: James Prestwood @ 2024-09-20 13:55 UTC (permalink / raw)
  To: iwd; +Cc: 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.
---
 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.

diff --git a/src/netdev.c b/src/netdev.c
index d95a2a1e..1e923805 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -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;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] netdev: allow empty TX/RX bitrate attributes
  2024-09-20 13:55 [PATCH v2] netdev: allow empty TX/RX bitrate attributes James Prestwood
@ 2024-09-20 15:27 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2024-09-20 15:27 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi James,

On 9/20/24 8:55 AM, James Prestwood wrote:
> 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.
> 

Applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-20 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-20 13:55 [PATCH v2] netdev: allow empty TX/RX bitrate attributes James Prestwood
2024-09-20 15:27 ` Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox