Message ID | 21a1abb0-300f-ccae-56da-16f016c4fff2@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 596690e9f4fc8f062a3f52b42071086721fd76fe |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next] ethtool: return error from ethnl_ops_begin if dev is NULL | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 4 maintainers not CCed: yajun.deng@linux.dev ffmancera@riseup.net yangbo.lu@nxp.com vladyslavt@nvidia.com |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 16 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
netdev/header_inline | success | Link |
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
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)
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(-)