* Re: [PATCH net] net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
2024-06-05 3:47 [PATCH net] net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool() Su Hui
@ 2024-06-05 4:05 ` Przemek Kitszel
2024-06-05 7:00 ` Hariprasad Kelam
2024-06-06 11:40 ` [PATCH net] " patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Przemek Kitszel @ 2024-06-05 4:05 UTC (permalink / raw)
To: Su Hui, davem, edumazet, kuba, pabeni, nathan, ndesaulniers,
morbo, justinstitt
Cc: andrew, ahmed.zaki, hkallweit1, justin.chen, jdamato, gerhard,
d-tatianin, netdev, linux-kernel, llvm, kernel-janitors
On 6/5/24 05:47, Su Hui wrote:
> 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@nfschina.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);
Thank you,
both the change and provided Fixes tag are correct.
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
2024-06-05 3:47 [PATCH net] net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool() Su Hui
2024-06-05 4:05 ` Przemek Kitszel
@ 2024-06-05 7:00 ` Hariprasad Kelam
2024-06-06 11:40 ` [PATCH net] " patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Hariprasad Kelam @ 2024-06-05 7:00 UTC (permalink / raw)
To: Su Hui, davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, nathan@kernel.org, ndesaulniers@google.com,
morbo@google.com, justinstitt@google.com
Cc: andrew@lunn.ch, ahmed.zaki@intel.com, hkallweit1@gmail.com,
justin.chen@broadcom.com, jdamato@fastly.com,
gerhard@engleder-embedded.com, d-tatianin@yandex-team.ru,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, kernel-janitors@vger.kernel.org
> 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@nfschina.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@marvell.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
2024-06-05 3:47 [PATCH net] net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool() Su Hui
2024-06-05 4:05 ` Przemek Kitszel
2024-06-05 7:00 ` Hariprasad Kelam
@ 2024-06-06 11:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-06 11:40 UTC (permalink / raw)
To: Su Hui
Cc: davem, edumazet, kuba, pabeni, nathan, ndesaulniers, morbo,
justinstitt, andrew, ahmed.zaki, hkallweit1, justin.chen, jdamato,
gerhard, d-tatianin, netdev, linux-kernel, llvm, kernel-janitors
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Wed, 5 Jun 2024 11:47:43 +0800 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net] net: ethtool: fix the error condition in ethtool_get_phy_stats_ethtool()
https://git.kernel.org/netdev/net/c/0dcc53abf58d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread