Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: ethtool: tsinfo: Fix dump command

Fix missing initialization of ts_info->phc_index in the dump command,
which could cause a netdev interface to incorrectly display a PTP provider
at index 0 instead of "none".
Fix it by initializing the phc_index to -1.

In the same time, restore missing initialization of ts_info.cmd for the
IOCTL case, as it was before the transition from ethnl_default_dumpit to
custom ethnl_tsinfo_dumpit.

Also, remove unnecessary zeroing of ts_info, as it is embedded within
reply_data, which is fully zeroed two lines earlier.

Fixes: b9e3f7dc9ed95 ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology")
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20250307091255.463559-1-kory.maincent@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Kory Maincent and committed by
Jakub Kicinski
d0a4a1b3 eab03963

+2 -1
+2 -1
net/ethtool/tsinfo.c
··· 290 290 reply_data = ctx->reply_data; 291 291 memset(reply_data, 0, sizeof(*reply_data)); 292 292 reply_data->base.dev = dev; 293 - memset(&reply_data->ts_info, 0, sizeof(reply_data->ts_info)); 293 + reply_data->ts_info.cmd = ETHTOOL_GET_TS_INFO; 294 + reply_data->ts_info.phc_index = -1; 294 295 295 296 return ehdr; 296 297 }