All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c:951 otx2_get_fecparam() warn: always true condition '(pfvf->linfo.fec < 4) => (0-3 < 4)'
@ 2021-07-23  6:24 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-07-23  6:24 UTC (permalink / raw)
  To: Christina Jacob
  Cc: kbuild-all, linux-kernel, Sunil Goutham, Hariprasad Kelam,
	Jesse Brandeburg

[-- Attachment #1: Type: text/plain, Size: 1807 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33203 bytes --]

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

* drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c:951 otx2_get_fecparam() warn: always true condition '(pfvf->linfo.fec < 4) => (0-3 < 4)'
@ 2021-07-23  6:24 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-07-23  6:24 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]

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(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33203 bytes --]

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

end of thread, other threads:[~2021-07-23  6:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23  6:24 drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c:951 otx2_get_fecparam() warn: always true condition '(pfvf->linfo.fec < 4) => (0-3 < 4)' kernel test robot
2021-07-23  6:24 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.