linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/net/ethernet/intel/ice/ice_main.c:789 ice_set_dflt_mib() warn: variable dereferenced before check 'pf' (see line 782)
@ 2020-10-07  8:22 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-10-07  8:22 UTC (permalink / raw)
  To: kbuild, Dave Ertman; +Cc: lkp, kbuild-all, linux-kernel, Tony Nguyen

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-07  8:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07  8:22 drivers/net/ethernet/intel/ice/ice_main.c:789 ice_set_dflt_mib() warn: variable dereferenced before check 'pf' (see line 782) Dan Carpenter

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).