diff mbox series

[v2] netdev: allow empty TX/RX bitrate attributes

Message ID 20240920135536.203657-1-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [v2] netdev: allow empty TX/RX bitrate attributes | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-alpine-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-incremental_build success Incremental build not run PASS
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-testrunner success test-runner PASS

Commit Message

James Prestwood Sept. 20, 2024, 1:55 p.m. UTC
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.

Comments

Denis Kenzior Sept. 20, 2024, 3:27 p.m. UTC | #1
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
diff mbox series

Patch

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;