* [PATCH ethtool] netlink: fix missing headers in text output
@ 2025-07-12 14:51 Jakub Kicinski
2025-07-15 13:40 ` Jakub Kicinski
2025-07-21 22:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Jakub Kicinski @ 2025-07-12 14:51 UTC (permalink / raw)
To: mkubecek; +Cc: netdev, ant.v.moryakov, Jakub Kicinski
The commit under fixes added a NULL-check which prevents us from
printing text headers. Conversions to add JSON support often use:
print_string(PRINT_FP, NULL, "some text:\n", NULL);
to print in plain text mode.
Correct output:
Channel parameters for vpn0:
Pre-set maximums:
RX: n/a
TX: n/a
Other: n/a
Combined: 1
Current hardware settings:
RX: n/a
TX: n/a
Other: n/a
Combined: 0
With the buggy patch:
Channel parameters for vpn0:
RX: n/a
TX: n/a
Other: n/a
Combined: 1
RX: n/a
TX: n/a
Other: n/a
Combined: 0
Fixes: fd328ccb3cc0 ("json_print: add NULL check before jsonw_string_field() in print_string()")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
json_print.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/json_print.c b/json_print.c
index 4f61640392cf..e07c651f477b 100644
--- a/json_print.c
+++ b/json_print.c
@@ -143,10 +143,11 @@ void print_string(enum output_type type,
} else if (_IS_FP_CONTEXT(type)) {
if (value)
fprintf(stdout, fmt, value);
+ else
+ fprintf(stdout, fmt);
}
}
-
/*
* value's type is bool. When using this function in FP context you can't pass
* a value to it, you will need to use "is_json_context()" to have different
--
2.50.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH ethtool] netlink: fix missing headers in text output
2025-07-12 14:51 [PATCH ethtool] netlink: fix missing headers in text output Jakub Kicinski
@ 2025-07-15 13:40 ` Jakub Kicinski
2025-07-17 12:04 ` Michal Kubecek
2025-07-21 22:30 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2025-07-15 13:40 UTC (permalink / raw)
To: mkubecek; +Cc: netdev, ant.v.moryakov
On Sat, 12 Jul 2025 07:51:05 -0700 Jakub Kicinski wrote:
> The commit under fixes added a NULL-check which prevents us from
> printing text headers. Conversions to add JSON support often use:
Hi Michal!
Would you be able to apply this ASAP and cut a release?
AFAICT this bug has made its way to Fedora, at least.
And some scripts try to match on the section text..
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH ethtool] netlink: fix missing headers in text output
2025-07-12 14:51 [PATCH ethtool] netlink: fix missing headers in text output Jakub Kicinski
2025-07-15 13:40 ` Jakub Kicinski
@ 2025-07-21 22:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-21 22:30 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: mkubecek, netdev, ant.v.moryakov
Hello:
This patch was applied to ethtool/ethtool.git (master)
by Michal Kubecek <mkubecek@suse.cz>:
On Sat, 12 Jul 2025 07:51:05 -0700 you wrote:
> The commit under fixes added a NULL-check which prevents us from
> printing text headers. Conversions to add JSON support often use:
>
> print_string(PRINT_FP, NULL, "some text:\n", NULL);
>
> to print in plain text mode.
>
> [...]
Here is the summary with links:
- [ethtool] netlink: fix missing headers in text output
https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=b70c92866102
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <0bcad81d1d004c74abfbb73eacbe6ec2@amazon.com>]
* RE: [PATCH ethtool] netlink: fix missing headers in text output
[not found] <0bcad81d1d004c74abfbb73eacbe6ec2@amazon.com>
@ 2025-07-15 11:52 ` Arinzon, David
0 siblings, 0 replies; 5+ messages in thread
From: Arinzon, David @ 2025-07-15 11:52 UTC (permalink / raw)
To: kuba@kernel.org, mkubecek@suse.cz
Cc: netdev@vger.kernel.org, ant.v.moryakov@gmail.com
> The commit under fixes added a NULL-check which prevents us from
> printing text headers. Conversions to add JSON support often use:
>
> print_string(PRINT_FP, NULL, "some text:\n", NULL);
>
> to print in plain text mode.
>
> Correct output:
>
> Channel parameters for vpn0:
> Pre-set maximums:
> RX: n/a
> TX: n/a
> Other: n/a
> Combined: 1
> Current hardware settings:
> RX: n/a
> TX: n/a
> Other: n/a
> Combined: 0
>
> With the buggy patch:
>
> Channel parameters for vpn0:
> RX: n/a
> TX: n/a
> Other: n/a
> Combined: 1
> RX: n/a
> TX: n/a
> Other: n/a
> Combined: 0
>
> Fixes: fd328ccb3cc0 ("json_print: add NULL check before jsonw_string_field() in print_string()")
> Signed-off-by: Jakub Kicinski mailto:kuba@kernel.org
> ---
> json_print.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/json_print.c b/json_print.c
> index 4f61640392cf..e07c651f477b 100644
> --- a/json_print.c
> +++ b/json_print.c
> @@ -143,10 +143,11 @@ void print_string(enum output_type type,
> } else if (_IS_FP_CONTEXT(type)) {
> if (value)
> fprintf(stdout, fmt, value);
> + else
> + fprintf(stdout, fmt);
> }
> }
>
> -
> /*
> * value's type is bool. When using this function in FP context you can't pass
> * a value to it, you will need to use "is_json_context()" to have different
> --
> 2.50.1
Thanks for identifying the issue and proposing the fix.
Reviewed-by: David Arinzon <mailto:darinzon@amazon.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-07-21 22:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-12 14:51 [PATCH ethtool] netlink: fix missing headers in text output Jakub Kicinski
2025-07-15 13:40 ` Jakub Kicinski
2025-07-17 12:04 ` Michal Kubecek
2025-07-21 22:30 ` patchwork-bot+netdevbpf
[not found] <0bcad81d1d004c74abfbb73eacbe6ec2@amazon.com>
2025-07-15 11:52 ` Arinzon, David
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.