Skip to content

Commit

Permalink
net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Su Hui authored and Paolo Abeni committed Jun 6, 2024
1 parent b01e1c0 commit 0dcc53a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ethtool/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2220,7 +2220,7 @@ static int ethtool_get_phy_stats_ethtool(struct net_device *dev,
const struct ethtool_ops *ops = dev->ethtool_ops;
int n_stats, ret;

if (!ops || !ops->get_sset_count || ops->get_ethtool_phy_stats)
if (!ops || !ops->get_sset_count || !ops->get_ethtool_phy_stats)
return -EOPNOTSUPP;

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

0 comments on commit 0dcc53a

Please sign in to comment.