lkml.org 
[lkml]   [2021]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectdrivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c:951 otx2_get_fecparam() warn: always true condition '(pfvf->linfo.fec < 4) => (0-3 < 4)'
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 8baef6386baaefb776bdd09b5c7630cf057c51c6
commit: d0cf9503e908ee7b235a5efecedeb74aabc482f3 octeontx2-pf: ethtool fec mode support
date: 5 months ago
config: ia64-randconfig-m031-20210723 (attached as .config)
compiler: ia64-linux-gcc (GCC) 10.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

New smatch warnings:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c:951 otx2_get_fecparam() warn: always true condition '(pfvf->linfo.fec < 4) => (0-3 < 4)'

Old smatch warnings:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c:962 otx2_get_fecparam() error: buffer overflow 'fec' 4 <= 4

vim +951 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c

939
940 static int otx2_get_fecparam(struct net_device *netdev,
941 struct ethtool_fecparam *fecparam)
942 {
943 struct otx2_nic *pfvf = netdev_priv(netdev);
944 struct cgx_fw_data *rsp;
945 const int fec[] = {
946 ETHTOOL_FEC_OFF,
947 ETHTOOL_FEC_BASER,
948 ETHTOOL_FEC_RS,
949 ETHTOOL_FEC_BASER | ETHTOOL_FEC_RS};
950 #define FEC_MAX_INDEX 4
> 951 if (pfvf->linfo.fec < FEC_MAX_INDEX)
952 fecparam->active_fec = fec[pfvf->linfo.fec];
953
954 rsp = otx2_get_fwdata(pfvf);
955 if (IS_ERR(rsp))
956 return PTR_ERR(rsp);
957
958 if (rsp->fwdata.supported_fec <= FEC_MAX_INDEX) {
959 if (!rsp->fwdata.supported_fec)
960 fecparam->fec = ETHTOOL_FEC_NONE;
961 else
962 fecparam->fec = fec[rsp->fwdata.supported_fec];
963 }
964 return 0;
965 }
966

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2021-07-23 08:26    [W:0.050 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site