ethtool: fec: fix FEC_NONE check

Dan points out we need to use the mask not the bit (which is 0).

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 42ce127d98 ("ethtool: fec: sanitize ethtool_fecparam->fec")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: hongrongxuan <hongrongxuan@huawei.com>
This commit is contained in:
Jakub Kicinski 2021-03-26 13:22:22 -07:00 committed by Jianping Liu
parent 6b49a53e47
commit 470e1485a3
1 changed files with 1 additions and 1 deletions

View File

@ -2509,7 +2509,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;