ethtool: fix ethtool msg len calculation for pause stats
authorJakub Kicinski <kuba@kernel.org>
Tue, 2 Nov 2021 22:02:36 +0000 (15:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:17:06 +0000 (19:17 +0100)
commit2e746ef502c9aa6801eafad4b76d4a5c62660bef
treebe6a786da7e2ce90136b1828b197129444e46624
parent351237a76e3fa1470f0c77f39074f4599085855d
ethtool: fix ethtool msg len calculation for pause stats

[ Upstream commit 1aabe578dd86e9f2867c4db4fba9a15f4ba1825d ]

ETHTOOL_A_PAUSE_STAT_MAX is the MAX attribute id,
so we need to subtract non-stats and add one to
get a count (IOW -2+1 == -1).

Otherwise we'll see:

  ethnl cmd 21: calculated reply length 40, but consumed 52

Fixes: 9a27a33027f2 ("ethtool: add standard pause stats")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/ethtool_netlink.h
include/uapi/linux/ethtool_netlink.h
net/ethtool/pause.c