[PATCH][next] ethtool: fec: Fix bitwise-and with ETHTOOL_FEC_NONE

Subsystems: networking [ethtool], networking [general], the rest

STALE2011d

2 messages, 2 authors, 2021-03-26 · open the first message on its own page

[PATCH][next] ethtool: fec: Fix bitwise-and with ETHTOOL_FEC_NONE

From: Colin King <hidden>
Date: 2021-03-26 14:28:35

From: Colin Ian King <redacted>

Currently ETHTOOL_FEC_NONE_BIT is being used as a mask, however
this is zero and the mask should be using ETHTOOL_FEC_NONE instead.
Fix this.

Addresses-Coverity: ("Bitwise-and with zero")
Fixes: 42ce127d9864 ("ethtool: fec: sanitize ethtool_fecparam->fec")
Signed-off-by: Colin Ian King <redacted>
---
 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 8797533ddc4b..26b3e7086075 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -2586,7 +2586,7 @@ static int ethtool_set_fecparam(struct net_device *dev, void __user *useraddr)
 	if (copy_from_user(&fecparam, useraddr, sizeof(fecparam)))
 		return -EFAULT;
 
-	if (!fecparam.fec || fecparam.fec & ETHTOOL_FEC_NONE_BIT)
+	if (!fecparam.fec || fecparam.fec & ETHTOOL_FEC_NONE)
 		return -EINVAL;
 
 	fecparam.active_fec = 0;
-- 
2.30.2

Re: [PATCH][next] ethtool: fec: Fix bitwise-and with ETHTOOL_FEC_NONE

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-03-26 23:01:16

Hello:

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

On Fri, 26 Mar 2021 14:27:33 +0000 you wrote:
From: Colin Ian King <redacted>

Currently ETHTOOL_FEC_NONE_BIT is being used as a mask, however
this is zero and the mask should be using ETHTOOL_FEC_NONE instead.
Fix this.

Addresses-Coverity: ("Bitwise-and with zero")
Fixes: 42ce127d9864 ("ethtool: fec: sanitize ethtool_fecparam->fec")
Signed-off-by: Colin Ian King <redacted>

[...]
Here is the summary with links:
  - [next] ethtool: fec: Fix bitwise-and with ETHTOOL_FEC_NONE
    https://git.kernel.org/netdev/net-next/c/cf2cc0bf4fde

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help