Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net-next] ethtool: return error from ethnl_ops_begin if dev is NULL
@ 2021-08-05 19:08 Heiner Kallweit
  2021-08-06  9:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2021-08-05 19:08 UTC (permalink / raw)
  To: Jakub Kicinski, David Miller; +Cc: netdev, Julian Wiedmann

Julian reported that after d43c65b05b84 Coverity complains about a
missing check whether dev is NULL in ethnl_ops_complete().
There doesn't seem to be any valid case where dev could be NULL when
calling ethnl_ops_begin(), therefore return an error if dev is NULL.

Fixes: d43c65b05b84 ("ethtool: runtime-resume netdev parent in ethnl_ops_begin")
Reported-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 net/ethtool/netlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c
index 417aaf9ca..fe8bf2b3c 100644
--- a/net/ethtool/netlink.c
+++ b/net/ethtool/netlink.c
@@ -35,7 +35,7 @@ int ethnl_ops_begin(struct net_device *dev)
 	int ret;
 
 	if (!dev)
-		return 0;
+		return -ENODEV;
 
 	if (dev->dev.parent)
 		pm_runtime_get_sync(dev->dev.parent);
@@ -61,7 +61,7 @@ int ethnl_ops_begin(struct net_device *dev)
 
 void ethnl_ops_complete(struct net_device *dev)
 {
-	if (dev && dev->ethtool_ops->complete)
+	if (dev->ethtool_ops->complete)
 		dev->ethtool_ops->complete(dev);
 
 	if (dev->dev.parent)
-- 
2.32.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] ethtool: return error from ethnl_ops_begin if dev is NULL
  2021-08-05 19:08 [PATCH net-next] ethtool: return error from ethnl_ops_begin if dev is NULL Heiner Kallweit
@ 2021-08-06  9:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-06  9:40 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: kuba, davem, netdev, jwi

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Thu, 5 Aug 2021 21:08:22 +0200 you wrote:
> Julian reported that after d43c65b05b84 Coverity complains about a
> missing check whether dev is NULL in ethnl_ops_complete().
> There doesn't seem to be any valid case where dev could be NULL when
> calling ethnl_ops_begin(), therefore return an error if dev is NULL.
> 
> Fixes: d43c65b05b84 ("ethtool: runtime-resume netdev parent in ethnl_ops_begin")
> Reported-by: Julian Wiedmann <jwi@linux.ibm.com>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> 
> [...]

Here is the summary with links:
  - [net-next] ethtool: return error from ethnl_ops_begin if dev is NULL
    https://git.kernel.org/netdev/net-next/c/596690e9f4fc

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] 2+ messages in thread

end of thread, other threads:[~2021-08-06  9:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 19:08 [PATCH net-next] ethtool: return error from ethnl_ops_begin if dev is NULL Heiner Kallweit
2021-08-06  9:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).