linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Dave Ertman <david.m.ertman@intel.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org,
	Tony Nguyen <anthony.l.nguyen@intel.com>
Subject: drivers/net/ethernet/intel/ice/ice_main.c:789 ice_set_dflt_mib() warn: variable dereferenced before check 'pf' (see line 782)
Date: Wed, 7 Oct 2020 11:22:19 +0300	[thread overview]
Message-ID: <20201007082219.GQ4282@kadam> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   22fbc037cd32e4e6771d2271b565806cfb8c134c
commit: 7d9c9b791f9e275b49870b6b10a1ea4d49209de8 ice: Implement LFC workaround
config: x86_64-randconfig-m001-20201003 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

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

smatch warnings:
drivers/net/ethernet/intel/ice/ice_main.c:789 ice_set_dflt_mib() warn: variable dereferenced before check 'pf' (see line 782)

vim +/pf +789 drivers/net/ethernet/intel/ice/ice_main.c

7d9c9b791f9e275 Dave Ertman            2020-07-13  780  static void ice_set_dflt_mib(struct ice_pf *pf)
7d9c9b791f9e275 Dave Ertman            2020-07-13  781  {
7d9c9b791f9e275 Dave Ertman            2020-07-13 @782  	struct device *dev = ice_pf_to_dev(pf);
                                                                                                   ^^
Derferenced

7d9c9b791f9e275 Dave Ertman            2020-07-13  783  	u8 mib_type, *buf, *lldpmib = NULL;
7d9c9b791f9e275 Dave Ertman            2020-07-13  784  	u16 len, typelen, offset = 0;
7d9c9b791f9e275 Dave Ertman            2020-07-13  785  	struct ice_lldp_org_tlv *tlv;
7d9c9b791f9e275 Dave Ertman            2020-07-13  786  	struct ice_hw *hw;
7d9c9b791f9e275 Dave Ertman            2020-07-13  787  	u32 ouisubtype;
7d9c9b791f9e275 Dave Ertman            2020-07-13  788  
7d9c9b791f9e275 Dave Ertman            2020-07-13 @789  	if (!pf) {
                                                                    ^^^
Checked too late.

7d9c9b791f9e275 Dave Ertman            2020-07-13  790  		dev_dbg(dev, "%s NULL pf pointer\n", __func__);
7d9c9b791f9e275 Dave Ertman            2020-07-13  791  		return;
7d9c9b791f9e275 Dave Ertman            2020-07-13  792  	}
7d9c9b791f9e275 Dave Ertman            2020-07-13  793  
7d9c9b791f9e275 Dave Ertman            2020-07-13  794  	hw = &pf->hw;
7d9c9b791f9e275 Dave Ertman            2020-07-13  795  	mib_type = SET_LOCAL_MIB_TYPE_LOCAL_MIB;
7d9c9b791f9e275 Dave Ertman            2020-07-13  796  	lldpmib = kzalloc(ICE_LLDPDU_SIZE, GFP_KERNEL);
7d9c9b791f9e275 Dave Ertman            2020-07-13  797  	if (!lldpmib) {

---
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: 30705 bytes --]

                 reply	other threads:[~2020-10-07  8:22 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=20201007082219.GQ4282@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=david.m.ertman@intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.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;
as well as URLs for NNTP newsgroup(s).