Netdev List
 help / color / mirror / Atom feed
From: Dave Seddon <dave.seddon.ca@gmail.com>
To: Michal Kubecek <mkubecek@suse.cz>, netdev@vger.kernel.org
Cc: Dave Seddon <dave.seddon.ca@gmail.com>,
	Taehee Yoo <ap420073@gmail.com>, Andrew Lunn <andrew@lunn.ch>
Subject: [PATCH ethtool v2 2/2] netlink: cable_test: require a value for the TDR parameters
Date: Mon,  2 Nov 2026 10:51:21 -0800	[thread overview]
Message-ID: <20261102185122.1357927-3-dave.seddon.ca@gmail.com> (raw)
In-Reply-To: <20261102185122.1357927-1-dave.seddon.ca@gmail.com>

first, last, step and pair (--cable-test-tdr) take a value, but their
parser entries leave min_argc at 0. Given as the last word on the
line, the value handler reads the NULL that ends argv and the error
message prints it:

  # ethtool --cable-test-tdr eth0 first 1 last
  ethtool (--cable-test-tdr): invalid value '(null)' for parameter 'last'

Set min_argc to 1, as every other value-taking parameter does, so the
parser reports the missing value itself:

  # ethtool --cable-test-tdr eth0 first 1 last
  ethtool (--cable-test-tdr): no value for parameter 'last'

Only the message changes: the exit status was already 1 and no request
was sent.

Fixes: 9561db9b76f4 ("Add cable test TDR support")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Dave Seddon <dave.seddon.ca@gmail.com>
---
 netlink/cable_test.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/netlink/cable_test.c b/netlink/cable_test.c
index fdb046e..648bf74 100644
--- a/netlink/cable_test.c
+++ b/netlink/cable_test.c
@@ -544,24 +544,28 @@ static const struct param_parser tdr_params[] = {
 		.type		= ETHTOOL_A_CABLE_TEST_TDR_CFG_FIRST,
 		.group		= ETHTOOL_A_CABLE_TEST_TDR_CFG,
 		.handler	= nl_parse_direct_m2cm,
+		.min_argc	= 1,
 	},
 	{
 		.arg		= "last",
 		.type		= ETHTOOL_A_CABLE_TEST_TDR_CFG_LAST,
 		.group		= ETHTOOL_A_CABLE_TEST_TDR_CFG,
 		.handler	= nl_parse_direct_m2cm,
+		.min_argc	= 1,
 	},
 	{
 		.arg		= "step",
 		.type		= ETHTOOL_A_CABLE_TEST_TDR_CFG_STEP,
 		.group		= ETHTOOL_A_CABLE_TEST_TDR_CFG,
 		.handler	= nl_parse_direct_m2cm,
+		.min_argc	= 1,
 	},
 	{
 		.arg		= "pair",
 		.type		= ETHTOOL_A_CABLE_TEST_TDR_CFG_PAIR,
 		.group		= ETHTOOL_A_CABLE_TEST_TDR_CFG,
 		.handler	= nl_parse_direct_u8,
+		.min_argc	= 1,
 	},
 	{}
 };
-- 
2.56.0


  parent reply	other threads:[~2026-11-02 18:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 18:51 [PATCH ethtool v2 0/2] netlink: require a value for hds-thresh and the TDR parameters Dave Seddon
2026-11-02 18:51 ` [PATCH ethtool v2 1/2] netlink: rings: require a value for hds-thresh Dave Seddon
2026-11-02 18:51 ` Dave Seddon [this message]
2026-11-03 13:31   ` [PATCH ethtool v2 2/2] netlink: cable_test: require a value for the TDR parameters Andrew Lunn

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=20261102185122.1357927-3-dave.seddon.ca@gmail.com \
    --to=dave.seddon.ca@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=ap420073@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox