ethtool: zero initialize coalesce struct
Subsystems (2)
PATCH 1/1 ethtool: zero initialize coalesce struct
From: Maciej Żenczykowski <[email protected]>
prior to fetching it from kernel.
Otherwise we run the risk of very tail portion of it (dmac field) being left entirely uninitialized, and likely containing some sort of stale data.
It seems to likely be some sort of time (a second's counter).
Tested:
'ethtool -c eth1' with old kernel now reports 'dmac: 0' where previously it reported some sort of second counter.
--- ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ethtool.c +1 -1
@@ -2076,7 +2076,7 @@ static int do_gchannels(struct cmd_context *ctx)static int do_gcoalesce (struct cmd_context *ctx) { -struct ethtool_coalesce ecoal; +struct ethtool_coalesce ecoal = {};int err;if (ctx->argc !=0 )
Signature · 1 line
2.20.0.405.gbc1bbc6f85-goog
Quoted 7 lines · Maciej Żenczykowski
From: Maciej Żenczykowski <[email protected]>
prior to fetching it from kernel.
Otherwise we run the risk of very tail portion of it (dmac field) being left entirely uninitialized, and likely containing some sort of stale data.
The dmac member of struct ethtool_coalesce was removed by commit c0b078ce7e88 ("Revert "ethtool: Add DMA Coalescing support"") because it has never been added in kernel (as that would break compatibility with older ethtool versions).
Michal Kubecek
Quoted 4 lines
The dmac member of struct
ethtool_coalescewas removed by commitc0b078ce7e88("Revert "ethtool: Add DMA Coalescing support"") because it has never been added in kernel (as that would break compatibility with older ethtool versions).
Hmm, well, it doesn't hurt to zero init either way...
I handed over ethtool to John Linville some time ago.
Ben.
Quoted 32 lines · Maciej Żenczykowski
From: Maciej Żenczykowski <[email protected]>
prior to fetching it from kernel.
Otherwise we run the risk of very tail portion of it (dmac field) being left entirely uninitialized, and likely containing some sort of stale data.
It seems to likely be some sort of time (a second's counter).
Tested:
'ethtool -c eth1' with old kernel now reports 'dmac: 0' where previously it reported some sort of second counter.Signed-off-by Maciej Żenczykowski <[email protected]>--- ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)ethtool.c +1
-1@@ -2076,7 +2076,7 @@ static int do_gchannels(struct cmd_context *ctx)static int do_gcoalesce (struct cmd_context *ctx) { -struct ethtool_coalesce ecoal; +struct ethtool_coalesce ecoal = {};int err;if (ctx->argc !=0 )
Signature · 2 lines
Ben Hutchings If you seem to know what you are doing, you'll be given more to do.
Quoted 8 lines · Maciej Żenczykowski
From: Maciej Żenczykowski <[email protected]>
prior to fetching it from kernel.
Otherwise we run the risk of very tail portion of it (dmac field) being left entirely uninitialized, and likely containing some sort of stale data.
Quoted 7 lines
It seems to likely be some sort of time (a second's counter).
Tested:
'ethtool -c eth1' with old kernel now reports 'dmac: 0' where previously it reported some sort of second counter.Signed-off-by Maciej Żenczykowski <[email protected]>
Queued for next release.
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.