From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Cai Huoqing <cai.huoqing@linux.dev>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: drivers/net/ethernet/huawei/hinic/hinic_port.c:459 hinic_set_vlan_fliter() warn: variable dereferenced before check 'hwdev' (see line 453)
Date: Tue, 12 Sep 2023 09:22:01 +0300 [thread overview]
Message-ID: <dce439ac-bf77-408a-b017-1ffe5ccdd755@kadam.mountain> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
commit: 2acf960e3be6177f437baade6d1883ebe4c641b2 net: hinic: Add support for configuration of rx-vlan-filter by ethtool
config: x86_64-randconfig-161-20230911 (https://download.01.org/0day-ci/archive/20230911/202309112354.pikZCmyk-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230911/202309112354.pikZCmyk-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202309112354.pikZCmyk-lkp@intel.com/
smatch warnings:
drivers/net/ethernet/huawei/hinic/hinic_port.c:459 hinic_set_vlan_fliter() warn: variable dereferenced before check 'hwdev' (see line 453)
vim +/hwdev +459 drivers/net/ethernet/huawei/hinic/hinic_port.c
2acf960e3be617 Cai Huoqing 2022-11-03 450 int hinic_set_vlan_fliter(struct hinic_dev *nic_dev, u32 en)
2acf960e3be617 Cai Huoqing 2022-11-03 451 {
2acf960e3be617 Cai Huoqing 2022-11-03 452 struct hinic_hwdev *hwdev = nic_dev->hwdev;
2acf960e3be617 Cai Huoqing 2022-11-03 @453 struct hinic_hwif *hwif = hwdev->hwif;
^^^^^^^
Dereference
2acf960e3be617 Cai Huoqing 2022-11-03 454 struct pci_dev *pdev = hwif->pdev;
2acf960e3be617 Cai Huoqing 2022-11-03 455 struct hinic_vlan_filter vlan_filter;
2acf960e3be617 Cai Huoqing 2022-11-03 456 u16 out_size = sizeof(vlan_filter);
2acf960e3be617 Cai Huoqing 2022-11-03 457 int err;
2acf960e3be617 Cai Huoqing 2022-11-03 458
2acf960e3be617 Cai Huoqing 2022-11-03 @459 if (!hwdev)
^^^^^^
Checked too late.
2acf960e3be617 Cai Huoqing 2022-11-03 460 return -EINVAL;
2acf960e3be617 Cai Huoqing 2022-11-03 461
2acf960e3be617 Cai Huoqing 2022-11-03 462 vlan_filter.func_idx = HINIC_HWIF_FUNC_IDX(hwif);
2acf960e3be617 Cai Huoqing 2022-11-03 463 vlan_filter.enable = en;
2acf960e3be617 Cai Huoqing 2022-11-03 464
2acf960e3be617 Cai Huoqing 2022-11-03 465 err = hinic_port_msg_cmd(hwdev, HINIC_PORT_CMD_SET_VLAN_FILTER,
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-09-12 6: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=dce439ac-bf77-408a-b017-1ffe5ccdd755@kadam.mountain \
--to=dan.carpenter@linaro.org \
--cc=cai.huoqing@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/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®