CC: [email protected]
BCC: [email protected]
TO: Liu Yi L <[email protected]>

tree:   https://github.com/luxis1999/iommufd vsva-iommufd-v5.18-rc4-joerg-branch
head:   1da48fc20a9603c05ac0e88aa4bc063cc426b232
commit: ecd2a281b1dd0543dbb6fcce44ada8a98588c0cf [6/42] iommufd: Algorithms for 
PFN storage
:::::: branch date: 8 hours ago
:::::: commit date: 7 days ago
config: i386-randconfig-m021-20220509 
(https://download.01.org/0day-ci/archive/20220509/[email protected]/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/iommu/iommufd/pages.c:991 iopt_area_fill_domains() error: uninitialized 
symbol 'index'.

vim +/index +991 drivers/iommu/iommufd/pages.c

ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   936  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   937  /**
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   938   * iopt_area_fill_domains() - 
Install PFNs into the area's domains
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   939   * @area: The area to act on
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   940   * @pages: The pages 
associated with the area (area->pages is NULL)
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   941   *
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   942   * Called during area 
creation. The area is freshly created and not inserted in
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   943   * the domains_itree yet. PFNs 
are read and loaded into every domain held in the
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   944   * area's io_pagetable and the 
area is installed in the domains_itree.
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   945   *
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   946   * On failure all domains are 
left unchanged.
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   947   */
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   948  int 
iopt_area_fill_domains(struct iopt_area *area, struct iopt_pages *pages)
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   949  {
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   950         struct pfn_reader pfns;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   951         struct iommu_domain 
*domain;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   952         unsigned long 
unmap_index;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   953         unsigned long index;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   954         int rc;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   955  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   956         
lockdep_assert_held(&area->iopt->domains_rwsem);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   957  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   958         if 
(xa_empty(&area->iopt->domains))
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   959                 return 0;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   960  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   961         
mutex_lock(&pages->mutex);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   962         rc = 
pfn_reader_first(&pfns, pages, iopt_area_index(area),
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   963                               
iopt_area_last_index(area));
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   964         if (rc)
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   965                 goto out_unlock;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   966  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   967         while 
(!pfn_reader_done(&pfns)) {
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   968                 xa_for_each 
(&area->iopt->domains, index, domain) {
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   969                         rc = 
batch_to_domain(&pfns.batch, domain, area,
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   970                                 
             pfns.batch_start_index);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   971                         if (rc)
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   972                                 
goto out_unmap;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   973                 }
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   974  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   975                 rc = 
pfn_reader_next(&pfns);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   976                 if (rc)
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   977                         goto 
out_unmap;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   978         }
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   979         rc = 
update_pinned(pages);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   980         if (rc)
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   981                 goto out_unmap;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   982  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   983         area->storage_domain = 
xa_load(&area->iopt->domains, 0);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   984         
interval_tree_insert(&area->pages_node, &pages->domains_itree);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   985         goto out_destroy;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   986  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   987  out_unmap:
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   988         xa_for_each 
(&area->iopt->domains, unmap_index, domain) {
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   989                 unsigned long 
end_index = pfns.batch_start_index;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   990  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  @991                 if (unmap_index 
<= index)
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   992                         
end_index = pfns.batch_end_index;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   993  
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   994                 /*
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   995                  * The area is 
not yet part of the domains_itree so we have to
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   996                  * manage the 
unpinning specially. The last domain does the
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   997                  * unpin, every 
other domain is just unmapped.
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   998                  */
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13   999                 if (unmap_index 
!= area->iopt->next_domain_id - 1) {
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1000                         if 
(end_index != iopt_area_index(area))
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1001                                 
iopt_area_unmap_domain_range(
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1002                                 
        area, domain, iopt_area_index(area),
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1003                                 
        end_index - 1);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1004                 } else {
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1005                         
iopt_area_unfill_partial_domain(area, pages, domain,
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1006                                 
                        end_index);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1007                 }
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1008         }
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1009  out_destroy:
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1010         
pfn_reader_destroy(&pfns);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1011  out_unlock:
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1012         
mutex_unlock(&pages->mutex);
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1013         return rc;
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1014  }
ecd2a281b1dd05 Jason Gunthorpe 2021-12-13  1015  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to