All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ethtool: zero initialize coalesce struct
@ 2018-12-15  1:19 Maciej Żenczykowski
  2018-12-15  2:26 ` Michal Kubecek
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Maciej Żenczykowski @ 2018-12-15  1:19 UTC (permalink / raw)
  To: Maciej Żenczykowski, Jeff Garzik, Ben Hutchings
  Cc: David S . Miller, David Decotigny, netdev

From: Maciej Żenczykowski <maze@google.com>

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 <maze@google.com>
---
 ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ethtool.c b/ethtool.c
index 2f7e96bb58db..465eeecb9318 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -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)
-- 
2.20.0.405.gbc1bbc6f85-goog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ethtool: zero initialize coalesce struct
  2018-12-15  1:19 [PATCH] ethtool: zero initialize coalesce struct Maciej Żenczykowski
@ 2018-12-15  2:26 ` Michal Kubecek
  2018-12-15  2:30   ` Maciej Żenczykowski
  2018-12-15 12:29 ` Ben Hutchings
  2019-01-18 18:40 ` John W. Linville
  2 siblings, 1 reply; 5+ messages in thread
From: Michal Kubecek @ 2018-12-15  2:26 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: Maciej Żenczykowski, Jeff Garzik, Ben Hutchings,
	David S . Miller, David Decotigny, netdev

On Fri, Dec 14, 2018 at 05:19:23PM -0800, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ethtool: zero initialize coalesce struct
  2018-12-15  2:26 ` Michal Kubecek
@ 2018-12-15  2:30   ` Maciej Żenczykowski
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej Żenczykowski @ 2018-12-15  2:30 UTC (permalink / raw)
  To: Michal Kubecek
  Cc: Jeff Garzik, Ben Hutchings, David S . Miller, David Decotigny,
	Linux NetDev

> 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).

Hmm, well, it doesn't hurt to zero init either way...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ethtool: zero initialize coalesce struct
  2018-12-15  1:19 [PATCH] ethtool: zero initialize coalesce struct Maciej Żenczykowski
  2018-12-15  2:26 ` Michal Kubecek
@ 2018-12-15 12:29 ` Ben Hutchings
  2019-01-18 18:40 ` John W. Linville
  2 siblings, 0 replies; 5+ messages in thread
From: Ben Hutchings @ 2018-12-15 12:29 UTC (permalink / raw)
  To: Maciej Żenczykowski, Maciej Żenczykowski, Jeff Garzik,
	John W. Linville
  Cc: David S . Miller, David Decotigny, netdev

[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]

I handed over ethtool to John Linville some time ago.

Ben.

On Fri, 2018-12-14 at 17:19 -0800, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> 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 <maze@google.com>
> ---
>  ethtool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/ethtool.c b/ethtool.c
> index 2f7e96bb58db..465eeecb9318 100644
> --- a/ethtool.c
> +++ b/ethtool.c
> @@ -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)
-- 
Ben Hutchings
If you seem to know what you are doing, you'll be given more to do.



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ethtool: zero initialize coalesce struct
  2018-12-15  1:19 [PATCH] ethtool: zero initialize coalesce struct Maciej Żenczykowski
  2018-12-15  2:26 ` Michal Kubecek
  2018-12-15 12:29 ` Ben Hutchings
@ 2019-01-18 18:40 ` John W. Linville
  2 siblings, 0 replies; 5+ messages in thread
From: John W. Linville @ 2019-01-18 18:40 UTC (permalink / raw)
  To: Maciej Żenczykowski
  Cc: Maciej Żenczykowski, Jeff Garzik, Ben Hutchings,
	David S . Miller, David Decotigny, netdev

On Fri, Dec 14, 2018 at 05:19:23PM -0800, Maciej Żenczykowski wrote:
> From: Maciej Żenczykowski <maze@google.com>
> 
> 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 <maze@google.com>

Queued for next release.

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-01-18 18:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-15  1:19 [PATCH] ethtool: zero initialize coalesce struct Maciej Żenczykowski
2018-12-15  2:26 ` Michal Kubecek
2018-12-15  2:30   ` Maciej Żenczykowski
2018-12-15 12:29 ` Ben Hutchings
2019-01-18 18:40 ` John W. Linville

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.