[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PH0PR18MB4474096265EED015A2A7FBE0DEF92@PH0PR18MB4474.namprd18.prod.outlook.com>
Date: Wed, 5 Jun 2024 07:00:38 +0000
From: Hariprasad Kelam <hkelam@...vell.com>
To: Su Hui <suhui@...china.com>, "davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org"
<kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"nathan@...nel.org" <nathan@...nel.org>,
"ndesaulniers@...gle.com"
<ndesaulniers@...gle.com>,
"morbo@...gle.com" <morbo@...gle.com>,
"justinstitt@...gle.com" <justinstitt@...gle.com>
CC: "andrew@...n.ch" <andrew@...n.ch>,
"ahmed.zaki@...el.com"
<ahmed.zaki@...el.com>,
"hkallweit1@...il.com" <hkallweit1@...il.com>,
"justin.chen@...adcom.com" <justin.chen@...adcom.com>,
"jdamato@...tly.com"
<jdamato@...tly.com>,
"gerhard@...leder-embedded.com"
<gerhard@...leder-embedded.com>,
"d-tatianin@...dex-team.ru"
<d-tatianin@...dex-team.ru>,
"netdev@...r.kernel.org"
<netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>,
"llvm@...ts.linux.dev"
<llvm@...ts.linux.dev>,
"kernel-janitors@...r.kernel.org"
<kernel-janitors@...r.kernel.org>
Subject: net: ethtool: fix the error condition in
ethtool_get_phy_stats_ethtool()
> 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: 201ed315f967 ("net/ethtool/ioctl: split ethtool_get_phy_stats into
> multiple helpers")
> Signed-off-by: Su Hui <suhui@...china.com>
> ---
> net/ethtool/ioctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index
> 5a55270aa86e..e645d751a5e8 100644
> --- a/net/ethtool/ioctl.c
> +++ b/net/ethtool/ioctl.c
> @@ -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);
> --
> 2.30.2
>
Good catch!!
Reviewed-by: Hariprasad Kelam <hkelam@...vell.com>
Powered by blists - more mailing lists