diff options
author | Daniil Tatianin <d-tatianin@yandex-team.ru> | 2022-12-26 14:48:25 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2022-12-28 11:55:24 +0000 |
commit | 201ed315f9676809cd5b20a39206e964106d4f27 (patch) | |
tree | 25f293f22789dad4be3fee157e22c4831b28dd54 /fs/hugetlbfs | |
parent | fd4778581d61d8848b532f8cdc9b325138748437 (diff) | |
download | linux-201ed315f9676809cd5b20a39206e964106d4f27.tar.bz2 |
net/ethtool/ioctl: split ethtool_get_phy_stats into multiple helpers
So that it's easier to follow and make sense of the branching and
various conditions.
Stats retrieval has been split into two separate functions
ethtool_get_phy_stats_phydev & ethtool_get_phy_stats_ethtool.
The former attempts to retrieve the stats using phydev & phy_ops, while
the latter uses ethtool_ops.
Actual n_stats validation & array allocation has been moved into a new
ethtool_vzalloc_stats_array helper.
This also fixes a potential NULL dereference of
ops->get_ethtool_phy_stats where it was getting called in an else branch
unconditionally without making sure it was actually present.
Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
Signed-off-by: Daniil Tatianin <d-tatianin@yandex-team.ru>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/hugetlbfs')
0 files changed, 0 insertions, 0 deletions