All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [yao:perf-intel-next 27/113] arch/x86/events/intel/uncore.c:1600 check_discovery_table() error: uninitialized symbol 'dvsec'.
Date: Tue, 02 Jun 2020 14:45:47 +0300	[thread overview]
Message-ID: <20200602114547.GC30374@kadam> (raw)

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

tree:   yao/perf-intel-next
head:   36086096ecdcd11f5dfc73d2780537e2483ac70b
commit: 7033482bbd4f555901cbe7f5e8fbcc8a2618851f [27/113] perf/x86/intel/uncore: Check discovery tables
config: i386-randconfig-m021-20200602 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

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

smatch warnings:
arch/x86/events/intel/uncore.c:1600 check_discovery_table() error: uninitialized symbol 'dvsec'.

git remote add yao git://bee.sh.intel.com/git/jinyao/linux.git
git remote update yao
git checkout 7033482bbd4f555901cbe7f5e8fbcc8a2618851f
vim +/dvsec +1600 arch/x86/events/intel/uncore.c

7033482bbd4f55 Kan Liang 2020-04-13  1586  
7033482bbd4f55 Kan Liang 2020-04-13  1587  bool __init check_discovery_table(void)
7033482bbd4f55 Kan Liang 2020-04-13  1588  {
7033482bbd4f55 Kan Liang 2020-04-13  1589  	struct uncore_discovery_table *table;
7033482bbd4f55 Kan Liang 2020-04-13  1590  	struct pci_dev *dev = NULL;
7033482bbd4f55 Kan Liang 2020-04-13  1591  	int dvsec, logical_die = 0;
                                                ^^^^^^^^^

7033482bbd4f55 Kan Liang 2020-04-13  1592  	u32 val, entry_id, bir;
7033482bbd4f55 Kan Liang 2020-04-13  1593  	bool ret = false;
7033482bbd4f55 Kan Liang 2020-04-13  1594  
7033482bbd4f55 Kan Liang 2020-04-13  1595  	/*
7033482bbd4f55 Kan Liang 2020-04-13  1596  	 * Check the existence of discovery table by searching all PCI devices
7033482bbd4f55 Kan Liang 2020-04-13  1597  	 * for unique capability ID.
7033482bbd4f55 Kan Liang 2020-04-13  1598  	 */
7033482bbd4f55 Kan Liang 2020-04-13  1599  	while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, dev)) != NULL) {
7033482bbd4f55 Kan Liang 2020-04-13 @1600  		while ((dvsec = pci_find_next_ext_capability(dev, dvsec, UNCORE_EXT_CAP_ID_DISCOVERY))) {
                                                                                                          ^^^^^
Uninitialized here.  KASAN will trigger a warning at runtime as well.

7033482bbd4f55 Kan Liang 2020-04-13  1601  			pci_read_config_dword(dev, dvsec + UNCORE_DISCOVERY_DVSEC_OFFSET, &val);
7033482bbd4f55 Kan Liang 2020-04-13  1602  			entry_id = val & UNCORE_DISCOVERY_DVSEC_ID_MASK;
7033482bbd4f55 Kan Liang 2020-04-13  1603  			if (entry_id == UNCORE_DISCOVERY_DVSEC_ID_PMON) {
7033482bbd4f55 Kan Liang 2020-04-13  1604  				table = kmalloc(sizeof(struct uncore_discovery_table), GFP_KERNEL);
7033482bbd4f55 Kan Liang 2020-04-13  1605  				if (!table)
7033482bbd4f55 Kan Liang 2020-04-13  1606  					continue;
7033482bbd4f55 Kan Liang 2020-04-13  1607  				pci_read_config_dword(dev, dvsec + UNCORE_DISCOVERY_DVSEC2_OFFSET, &val);
7033482bbd4f55 Kan Liang 2020-04-13  1608  				bir = val & UNCORE_DISCOVERY_DVSEC2_BIR_MASK;
7033482bbd4f55 Kan Liang 2020-04-13  1609  				table->domain = pci_domain_nr(dev->bus);
7033482bbd4f55 Kan Liang 2020-04-13  1610  				table->bus = dev->bus->number;
7033482bbd4f55 Kan Liang 2020-04-13  1611  				table->devfn = dev->devfn;
7033482bbd4f55 Kan Liang 2020-04-13  1612  				table->bar_offset = 0x10 + (bir * 4);
7033482bbd4f55 Kan Liang 2020-04-13  1613  				table->die = logical_die++;
7033482bbd4f55 Kan Liang 2020-04-13  1614  				if (discovery_table_pci2phy_map_init(dev, table->die)) {
7033482bbd4f55 Kan Liang 2020-04-13  1615  					kfree(table);
7033482bbd4f55 Kan Liang 2020-04-13  1616  					continue;
7033482bbd4f55 Kan Liang 2020-04-13  1617  				}
7033482bbd4f55 Kan Liang 2020-04-13  1618  				list_add_tail(&table->list, &discovery_table);
7033482bbd4f55 Kan Liang 2020-04-13  1619  				ret = true;
7033482bbd4f55 Kan Liang 2020-04-13  1620  				continue;
7033482bbd4f55 Kan Liang 2020-04-13  1621  			}
7033482bbd4f55 Kan Liang 2020-04-13  1622  		}
7033482bbd4f55 Kan Liang 2020-04-13  1623  	}
7033482bbd4f55 Kan Liang 2020-04-13  1624  	pci_dev_put(dev);
7033482bbd4f55 Kan Liang 2020-04-13  1625  
7033482bbd4f55 Kan Liang 2020-04-13  1626  	fill_up_pbus_to_physid_mapping(true);
7033482bbd4f55 Kan Liang 2020-04-13  1627  
7033482bbd4f55 Kan Liang 2020-04-13  1628  	return ret;
7033482bbd4f55 Kan Liang 2020-04-13  1629  }

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [yao:perf-intel-next 27/113] arch/x86/events/intel/uncore.c:1600 check_discovery_table() error: uninitialized symbol 'dvsec'.
Date: Tue, 02 Jun 2020 14:45:47 +0300	[thread overview]
Message-ID: <20200602114547.GC30374@kadam> (raw)

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

tree:   yao/perf-intel-next
head:   36086096ecdcd11f5dfc73d2780537e2483ac70b
commit: 7033482bbd4f555901cbe7f5e8fbcc8a2618851f [27/113] perf/x86/intel/uncore: Check discovery tables
config: i386-randconfig-m021-20200602 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

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

smatch warnings:
arch/x86/events/intel/uncore.c:1600 check_discovery_table() error: uninitialized symbol 'dvsec'.

git remote add yao git://bee.sh.intel.com/git/jinyao/linux.git
git remote update yao
git checkout 7033482bbd4f555901cbe7f5e8fbcc8a2618851f
vim +/dvsec +1600 arch/x86/events/intel/uncore.c

7033482bbd4f55 Kan Liang 2020-04-13  1586  
7033482bbd4f55 Kan Liang 2020-04-13  1587  bool __init check_discovery_table(void)
7033482bbd4f55 Kan Liang 2020-04-13  1588  {
7033482bbd4f55 Kan Liang 2020-04-13  1589  	struct uncore_discovery_table *table;
7033482bbd4f55 Kan Liang 2020-04-13  1590  	struct pci_dev *dev = NULL;
7033482bbd4f55 Kan Liang 2020-04-13  1591  	int dvsec, logical_die = 0;
                                                ^^^^^^^^^

7033482bbd4f55 Kan Liang 2020-04-13  1592  	u32 val, entry_id, bir;
7033482bbd4f55 Kan Liang 2020-04-13  1593  	bool ret = false;
7033482bbd4f55 Kan Liang 2020-04-13  1594  
7033482bbd4f55 Kan Liang 2020-04-13  1595  	/*
7033482bbd4f55 Kan Liang 2020-04-13  1596  	 * Check the existence of discovery table by searching all PCI devices
7033482bbd4f55 Kan Liang 2020-04-13  1597  	 * for unique capability ID.
7033482bbd4f55 Kan Liang 2020-04-13  1598  	 */
7033482bbd4f55 Kan Liang 2020-04-13  1599  	while ((dev = pci_get_device(PCI_VENDOR_ID_INTEL, PCI_ANY_ID, dev)) != NULL) {
7033482bbd4f55 Kan Liang 2020-04-13 @1600  		while ((dvsec = pci_find_next_ext_capability(dev, dvsec, UNCORE_EXT_CAP_ID_DISCOVERY))) {
                                                                                                          ^^^^^
Uninitialized here.  KASAN will trigger a warning at runtime as well.

7033482bbd4f55 Kan Liang 2020-04-13  1601  			pci_read_config_dword(dev, dvsec + UNCORE_DISCOVERY_DVSEC_OFFSET, &val);
7033482bbd4f55 Kan Liang 2020-04-13  1602  			entry_id = val & UNCORE_DISCOVERY_DVSEC_ID_MASK;
7033482bbd4f55 Kan Liang 2020-04-13  1603  			if (entry_id == UNCORE_DISCOVERY_DVSEC_ID_PMON) {
7033482bbd4f55 Kan Liang 2020-04-13  1604  				table = kmalloc(sizeof(struct uncore_discovery_table), GFP_KERNEL);
7033482bbd4f55 Kan Liang 2020-04-13  1605  				if (!table)
7033482bbd4f55 Kan Liang 2020-04-13  1606  					continue;
7033482bbd4f55 Kan Liang 2020-04-13  1607  				pci_read_config_dword(dev, dvsec + UNCORE_DISCOVERY_DVSEC2_OFFSET, &val);
7033482bbd4f55 Kan Liang 2020-04-13  1608  				bir = val & UNCORE_DISCOVERY_DVSEC2_BIR_MASK;
7033482bbd4f55 Kan Liang 2020-04-13  1609  				table->domain = pci_domain_nr(dev->bus);
7033482bbd4f55 Kan Liang 2020-04-13  1610  				table->bus = dev->bus->number;
7033482bbd4f55 Kan Liang 2020-04-13  1611  				table->devfn = dev->devfn;
7033482bbd4f55 Kan Liang 2020-04-13  1612  				table->bar_offset = 0x10 + (bir * 4);
7033482bbd4f55 Kan Liang 2020-04-13  1613  				table->die = logical_die++;
7033482bbd4f55 Kan Liang 2020-04-13  1614  				if (discovery_table_pci2phy_map_init(dev, table->die)) {
7033482bbd4f55 Kan Liang 2020-04-13  1615  					kfree(table);
7033482bbd4f55 Kan Liang 2020-04-13  1616  					continue;
7033482bbd4f55 Kan Liang 2020-04-13  1617  				}
7033482bbd4f55 Kan Liang 2020-04-13  1618  				list_add_tail(&table->list, &discovery_table);
7033482bbd4f55 Kan Liang 2020-04-13  1619  				ret = true;
7033482bbd4f55 Kan Liang 2020-04-13  1620  				continue;
7033482bbd4f55 Kan Liang 2020-04-13  1621  			}
7033482bbd4f55 Kan Liang 2020-04-13  1622  		}
7033482bbd4f55 Kan Liang 2020-04-13  1623  	}
7033482bbd4f55 Kan Liang 2020-04-13  1624  	pci_dev_put(dev);
7033482bbd4f55 Kan Liang 2020-04-13  1625  
7033482bbd4f55 Kan Liang 2020-04-13  1626  	fill_up_pbus_to_physid_mapping(true);
7033482bbd4f55 Kan Liang 2020-04-13  1627  
7033482bbd4f55 Kan Liang 2020-04-13  1628  	return ret;
7033482bbd4f55 Kan Liang 2020-04-13  1629  }

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

             reply	other threads:[~2020-06-02 11:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 11:45 Dan Carpenter [this message]
2020-06-02 11:45 ` [yao:perf-intel-next 27/113] arch/x86/events/intel/uncore.c:1600 check_discovery_table() error: uninitialized symbol 'dvsec' Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-06-02  3:28 kbuild test robot

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=20200602114547.GC30374@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /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 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.