Skip to content

Commit d0a4a1b

Browse files
kmaincentkuba-moo
authored andcommitted
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: b9e3f7d ("net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology") Signed-off-by: Kory Maincent <[email protected]> Reviewed-by: Vadim Fedorenko <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent eab0396 commit d0a4a1b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ethtool/tsinfo.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ static void *ethnl_tsinfo_prepare_dump(struct sk_buff *skb,
290290
reply_data = ctx->reply_data;
291291
memset(reply_data, 0, sizeof(*reply_data));
292292
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;
294295

295296
return ehdr;
296297
}

0 commit comments

Comments
 (0)