]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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>
Wed, 17 Nov 2021 10:04:37 +0000 (11:04 +0100)
commite75b136530ce8bade0b925bbfca5d8c2f8c61695
tree5cb393b3e3280ffdcc8a907074d31e8f5b9d51b0
parentf776103499bf0e850f6334b6d6d0b8d02893d941
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