Skip to contentSkip to conversation

drivers/iommu/dma-iommu.c:1698 iommu_dma_compose_msi_msg() error: uninitialized symbol 'msi_addr'.

PATCH New Dan Carpenter 1 participant 1 message Jun 19, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 43/50 drivers/iommu/dma-iommu.c:1698 iommu_dma_compose_msi_msg() error: uninitialized symbol 'msi_addr'.

tree:   https://github.com/avpatel/linux.git riscv_timer_imp_v1
head:   74a10c4f3857dece3424b109452f63add2baa7f6
commit: 59f0204d5995cda5dad48d7821d2d885a852f519 [43/50] irqchip/riscv-imsic: Improve IOMMU DMA support
config: i386-randconfig-m021-20230618 (https://download.01.org/0day-ci/archive/20230619/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230619/[email protected]/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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
drivers/iommu/dma-iommu.c:1698 iommu_dma_compose_msi_msg() error: uninitialized symbol 'msi_addr'.

Old smatch warnings:
drivers/iommu/dma-iommu.c:1358 iommu_dma_unmap_sg() error: uninitialized symbol 'start'.

vim +/msi_addr +1698 drivers/iommu/dma-iommu.c

ece6e6f0218b77 Julien Grall      2019-05-01  1679  
fa49364cd5e657 Robin Murphy      2022-08-16  1680  /**
fa49364cd5e657 Robin Murphy      2022-08-16  1681   * iommu_dma_compose_msi_msg() - Apply translation to an MSI message
fa49364cd5e657 Robin Murphy      2022-08-16  1682   * @desc: MSI descriptor prepared by iommu_dma_prepare_msi()
fa49364cd5e657 Robin Murphy      2022-08-16  1683   * @msg: MSI message containing target physical address
fa49364cd5e657 Robin Murphy      2022-08-16  1684   */
fa49364cd5e657 Robin Murphy      2022-08-16  1685  void iommu_dma_compose_msi_msg(struct msi_desc *desc, struct msi_msg *msg)
ece6e6f0218b77 Julien Grall      2019-05-01  1686  {
ece6e6f0218b77 Julien Grall      2019-05-01  1687  	struct device *dev = msi_desc_to_dev(desc);
ece6e6f0218b77 Julien Grall      2019-05-01  1688  	const struct iommu_domain *domain = iommu_get_domain_for_dev(dev);
ece6e6f0218b77 Julien Grall      2019-05-01  1689  	const struct iommu_dma_msi_page *msi_page;
59f0204d5995cd Anup Patel        2023-05-02  1690  	struct iommu_dma_cookie *cookie;
59f0204d5995cd Anup Patel        2023-05-02  1691  	phys_addr_t msi_addr;
59f0204d5995cd Anup Patel        2023-05-02  1692  
59f0204d5995cd Anup Patel        2023-05-02  1693  	if (!domain || !domain->iova_cookie)
59f0204d5995cd Anup Patel        2023-05-02  1694  		return;
ece6e6f0218b77 Julien Grall      2019-05-01  1695  
59f0204d5995cd Anup Patel        2023-05-02  1696  	cookie = domain->iova_cookie;
ece6e6f0218b77 Julien Grall      2019-05-01  1697  	msi_page = msi_desc_get_iommu_cookie(desc);
59f0204d5995cd Anup Patel        2023-05-02 @1698  	if (!msi_page || msi_page->phys != msi_addr) {
                                                                                           ^^^^^^^^

Uninitialized.

59f0204d5995cd Anup Patel        2023-05-02  1699  		msi_addr = ((u64)msg->address_hi << 32) | msg->address_lo;
59f0204d5995cd Anup Patel        2023-05-02  1700  		msi_addr &= ~(phys_addr_t)(cookie_msi_granule(cookie) - 1);
ece6e6f0218b77 Julien Grall      2019-05-01  1701  
59f0204d5995cd Anup Patel        2023-05-02  1702  		msi_desc_set_iommu_cookie(desc, NULL);
59f0204d5995cd Anup Patel        2023-05-02  1703  		list_for_each_entry(msi_page, &cookie->msi_page_list, list) {
59f0204d5995cd Anup Patel        2023-05-02  1704  			if (msi_page->phys == msi_addr) {
59f0204d5995cd Anup Patel        2023-05-02  1705  				msi_desc_set_iommu_cookie(desc, msi_page);
59f0204d5995cd Anup Patel        2023-05-02  1706  				break;
59f0204d5995cd Anup Patel        2023-05-02  1707  			}
59f0204d5995cd Anup Patel        2023-05-02  1708  		}
59f0204d5995cd Anup Patel        2023-05-02  1709  		msi_page = msi_desc_get_iommu_cookie(desc);
59f0204d5995cd Anup Patel        2023-05-02  1710  	}
59f0204d5995cd Anup Patel        2023-05-02  1711  	if (WARN_ON(!msi_page))
ece6e6f0218b77 Julien Grall      2019-05-01  1712  		return;
ece6e6f0218b77 Julien Grall      2019-05-01  1713  
44bb7e243bd4b4 Robin Murphy      2016-09-12  1714  	msg->address_hi = upper_32_bits(msi_page->iova);
59f0204d5995cd Anup Patel        2023-05-02  1715  	msg->address_lo &= cookie_msi_granule(cookie) - 1;
44bb7e243bd4b4 Robin Murphy      2016-09-12  1716  	msg->address_lo += lower_32_bits(msi_page->iova);
44bb7e243bd4b4 Robin Murphy      2016-09-12  1717  }
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki