mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Christina Jacob <cjacob@marvell.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Sunil Goutham <sgoutham@marvell.com>,
	Hariprasad Kelam <hkelam@marvell.com>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>
Subject: drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c:951 otx2_get_fecparam() warn: always true condition '(pfvf->linfo.fec < 4) => (0-3 < 4)'
Date: Fri, 23 Jul 2021 14:24:54 +0800	[thread overview]
Message-ID: <202107231446.1pJe2j76-lkp@intel.com> (raw)

[-- 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 --]

                 reply	other threads:[~2021-07-23  6:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202107231446.1pJe2j76-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=cjacob@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sgoutham@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®