From: Jakub Kicinski <kuba@kernel.org>
To: mkubecek@suse.cz
Cc: netdev@vger.kernel.org, ant.v.moryakov@gmail.com,
Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH ethtool] netlink: fix missing headers in text output
Date: Sat, 12 Jul 2025 07:51:05 -0700 [thread overview]
Message-ID: <20250712145105.4066308-1-kuba@kernel.org> (raw)
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
next reply other threads:[~2025-07-12 14:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-12 14:51 Jakub Kicinski [this message]
2025-07-15 13:40 ` [PATCH ethtool] netlink: fix missing headers in text output 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250712145105.4066308-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=ant.v.moryakov@gmail.com \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.