All of lore.kernel.org
 help / color / mirror / Atom feed
* [yao:perf-intel-next 27/113] arch/x86/events/intel/uncore.c:1600 check_discovery_table() error: uninitialized symbol 'dvsec'.
@ 2020-06-02 11:45 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-06-02 11:45 UTC (permalink / raw)
  To: kbuild

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

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [yao:perf-intel-next 27/113] arch/x86/events/intel/uncore.c:1600 check_discovery_table() error: uninitialized symbol 'dvsec'.
@ 2020-06-02  3:28 kbuild test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-06-02  3:28 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
TO: "Kan, Liang," <kan.liang@linux.intel.com>

tree:   yao/perf-intel-next
head:   36086096ecdcd11f5dfc73d2780537e2483ac70b
commit: 7033482bbd4f555901cbe7f5e8fbcc8a2618851f [27/113] perf/x86/intel/uncore: Check discovery tables
:::::: branch date: 7 days ago
:::::: commit date: 7 weeks ago
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))) {
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  }
7033482bbd4f55 Kan Liang 2020-04-13  1630  

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-06-02 11:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2020-06-02 11:45 ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2020-06-02  3:28 kbuild test robot

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.