netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: ethtool: correct MAX attribute value for stats
@ 2023-06-08 16:23 Jakub Kicinski
  2023-06-08 21:42 ` David Ahern
  2023-06-12  8:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2023-06-08 16:23 UTC (permalink / raw)
  To: davem; +Cc: netdev, edumazet, pabeni, Jakub Kicinski

When compiling YNL generated code compiler complains about
array-initializer-out-of-bounds. Turns out the MAX value
for STATS_GRP uses the value for STATS.

This may lead to random corruptions in user space (kernel
itself doesn't use this value as it never parses stats).

Fixes: f09ea6fb1272 ("ethtool: add a new command for reading standard stats")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 include/uapi/linux/ethtool_netlink.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h
index 1ebf8d455f07..73e2c10dc2cc 100644
--- a/include/uapi/linux/ethtool_netlink.h
+++ b/include/uapi/linux/ethtool_netlink.h
@@ -783,7 +783,7 @@ enum {
 
 	/* add new constants above here */
 	__ETHTOOL_A_STATS_GRP_CNT,
-	ETHTOOL_A_STATS_GRP_MAX = (__ETHTOOL_A_STATS_CNT - 1)
+	ETHTOOL_A_STATS_GRP_MAX = (__ETHTOOL_A_STATS_GRP_CNT - 1)
 };
 
 enum {
-- 
2.40.1


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

* Re: [PATCH net] net: ethtool: correct MAX attribute value for stats
  2023-06-08 16:23 [PATCH net] net: ethtool: correct MAX attribute value for stats Jakub Kicinski
@ 2023-06-08 21:42 ` David Ahern
  2023-06-12  8:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: David Ahern @ 2023-06-08 21:42 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni

On Thu, Jun 08, 2023 at 09:23:44AM -0700, Jakub Kicinski wrote:
> When compiling YNL generated code compiler complains about
> array-initializer-out-of-bounds. Turns out the MAX value
> for STATS_GRP uses the value for STATS.
> 
> This may lead to random corruptions in user space (kernel
> itself doesn't use this value as it never parses stats).
> 
> Fixes: f09ea6fb1272 ("ethtool: add a new command for reading standard stats")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  include/uapi/linux/ethtool_netlink.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h
> index 1ebf8d455f07..73e2c10dc2cc 100644
> --- a/include/uapi/linux/ethtool_netlink.h
> +++ b/include/uapi/linux/ethtool_netlink.h
> @@ -783,7 +783,7 @@ enum {
>  
>  	/* add new constants above here */
>  	__ETHTOOL_A_STATS_GRP_CNT,
> -	ETHTOOL_A_STATS_GRP_MAX = (__ETHTOOL_A_STATS_CNT - 1)
> +	ETHTOOL_A_STATS_GRP_MAX = (__ETHTOOL_A_STATS_GRP_CNT - 1)
>  };
>  
>  enum {
> -- 
> 2.40.1
> 

Reviewed-by: David Ahern <dsahern@kernel.org>

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

* Re: [PATCH net] net: ethtool: correct MAX attribute value for stats
  2023-06-08 16:23 [PATCH net] net: ethtool: correct MAX attribute value for stats Jakub Kicinski
  2023-06-08 21:42 ` David Ahern
@ 2023-06-12  8:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-12  8:00 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: davem, netdev, edumazet, pabeni

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Thu,  8 Jun 2023 09:23:44 -0700 you wrote:
> When compiling YNL generated code compiler complains about
> array-initializer-out-of-bounds. Turns out the MAX value
> for STATS_GRP uses the value for STATS.
> 
> This may lead to random corruptions in user space (kernel
> itself doesn't use this value as it never parses stats).
> 
> [...]

Here is the summary with links:
  - [net] net: ethtool: correct MAX attribute value for stats
    https://git.kernel.org/netdev/net/c/52f79609c0c5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-06-12  8:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 16:23 [PATCH net] net: ethtool: correct MAX attribute value for stats Jakub Kicinski
2023-06-08 21:42 ` David Ahern
2023-06-12  8:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).