net: ethtool: tsinfo: Fix dump command
Subsystems (3)
PATCH v2 1/1 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.
---
Change in v2:
- Remove useless zeroed of ts_info.
--- net/ethtool/tsinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ethtool/tsinfo.c +2 -1
@@ -290,7 +290,8 @@ static void *ethnl_tsinfo_prepare_dump(struct sk_buff *skb, reply_data = ctx->reply_data;memset (reply_data,0 ,sizeof (*reply_data)); reply_data->base.dev = dev; -memset (&reply_data->ts_info,0 ,sizeof (reply_data->ts_info)); + reply_data->ts_info.cmd =ETHTOOL_GET_TS_INFO ; + reply_data->ts_info.phc_index =-1 ;return ehdr; }
Signature · 1 line
2.34.1
Quoted 27 lines · Kory Maincent
Fix missing initialization of
ts_info->phc_indexin 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 thephc_indexto -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_dumpitto customethnl_tsinfo_dumpit.Also, remove unnecessary zeroing of
ts_info, as it is embedded withinreply_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 <[email protected]>---
Change in v2:
- Remove useless zeroed ofts_info.--- net/ethtool/tsinfo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/ethtool/tsinfo.c +0
-0
net/ethtool/tsinfo.c static void *ethnl_tsinfo_prepare_dump(struct sk_buff *skb, · line 297
Quoted 9 lines
net/ethtool/tsinfo.c +2
-1@@ -290,7 +290,8 @@ static void *ethnl_tsinfo_prepare_dump(struct sk_buff *skb, reply_data = ctx->reply_data;memset (reply_data,0 ,sizeof (*reply_data)); reply_data->base.dev = dev; -memset (&reply_data->ts_info,0 ,sizeof (reply_data->ts_info)); + reply_data->ts_info.cmd =ETHTOOL_GET_TS_INFO ; + reply_data->ts_info.phc_index =-1 ;return ehdr; }
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Fri, 7 Mar 2025 10:12:55 +0100 you wrote:
Fix missing initialization of
ts_info->phc_indexin 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 thephc_indexto -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_dumpitto customethnl_tsinfo_dumpit.[...]
Here is the summary with links:
- [net,v2] net: ethtool: tsinfo: Fix dump command
https://git.kernel.org/netdev/net/c/d0a4a1b36d7a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html