Skip to content

Commit be5cc41

Browse files
committed
net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
jira LE-1907 cve CVE-2024-40928 Rebuild_History Non-Buildable kernel-5.14.0-427.31.1.el9_4 commit-author Su Hui <suhui@nfschina.com> commit 0dcc53a Clang static checker (scan-build) warning: net/ethtool/ioctl.c:line 2233, column 2 Called function pointer is null (null dereference). Return '-EOPNOTSUPP' when 'ops->get_ethtool_phy_stats' is NULL to fix this typo error. Fixes: 201ed31 ("net/ethtool/ioctl: split ethtool_get_phy_stats into multiple helpers") Signed-off-by: Su Hui <suhui@nfschina.com> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Reviewed-by: Hariprasad Kelam <hkelam@marvell.com> Link: https://lore.kernel.org/r/20240605034742.921751-1-suhui@nfschina.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit 0dcc53a) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 5362101 commit be5cc41

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ethtool/ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ static int ethtool_get_phy_stats_ethtool(struct net_device *dev,
21342134
const struct ethtool_ops *ops = dev->ethtool_ops;
21352135
int n_stats, ret;
21362136

2137-
if (!ops || !ops->get_sset_count || ops->get_ethtool_phy_stats)
2137+
if (!ops || !ops->get_sset_count || !ops->get_ethtool_phy_stats)
21382138
return -EOPNOTSUPP;
21392139

21402140
n_stats = ops->get_sset_count(dev, ETH_SS_PHY_STATS);

0 commit comments

Comments
 (0)