CC: [email protected]
BCC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Tianyu Lan <[email protected]>

Hi Tianyu,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v5.19-rc4 next-20220628]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    
https://github.com/intel-lab-lkp/linux/commits/Tianyu-Lan/swiotlb-Split-up-single-swiotlb-lock/20220618-010819
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git 
mm-everything
:::::: branch date: 11 days ago
:::::: commit date: 11 days ago
config: x86_64-randconfig-m001-20220627 
(https://download.01.org/0day-ci/archive/20220629/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

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

smatch warnings:
kernel/dma/swiotlb.c:956 rmem_swiotlb_device_init() error: dereferencing freed 
memory 'mem'

vim +/mem +956 kernel/dma/swiotlb.c

f4111e39a52aa5d Claire Chang      2021-06-19  926  
0b84e4f8b793eb4 Claire Chang      2021-06-19  927  static int 
rmem_swiotlb_device_init(struct reserved_mem *rmem,
0b84e4f8b793eb4 Claire Chang      2021-06-19  928                               
    struct device *dev)
0b84e4f8b793eb4 Claire Chang      2021-06-19  929  {
0b84e4f8b793eb4 Claire Chang      2021-06-19  930       struct io_tlb_mem *mem 
= rmem->priv;
0b84e4f8b793eb4 Claire Chang      2021-06-19  931       unsigned long nslabs = 
rmem->size >> IO_TLB_SHIFT;
0b84e4f8b793eb4 Claire Chang      2021-06-19  932  
47bb420a6670ad3 Tianyu Lan        2022-06-17  933       /* Set Per-device io 
tlb area to one */
47bb420a6670ad3 Tianyu Lan        2022-06-17  934       unsigned int nareas = 1;
47bb420a6670ad3 Tianyu Lan        2022-06-17  935  
0b84e4f8b793eb4 Claire Chang      2021-06-19  936       /*
0b84e4f8b793eb4 Claire Chang      2021-06-19  937        * Since multiple 
devices can share the same pool, the private data,
0b84e4f8b793eb4 Claire Chang      2021-06-19  938        * io_tlb_mem struct, 
will be initialized by the first device attached
0b84e4f8b793eb4 Claire Chang      2021-06-19  939        * to it.
0b84e4f8b793eb4 Claire Chang      2021-06-19  940        */
0b84e4f8b793eb4 Claire Chang      2021-06-19  941       if (!mem) {
463e862ac63ef27 Will Deacon       2021-07-20  942               mem = 
kzalloc(sizeof(*mem), GFP_KERNEL);
0b84e4f8b793eb4 Claire Chang      2021-06-19  943               if (!mem)
0b84e4f8b793eb4 Claire Chang      2021-06-19  944                       return 
-ENOMEM;
0b84e4f8b793eb4 Claire Chang      2021-06-19  945  
404f9373c4e5c94 Robin Murphy      2022-01-24  946               mem->slots = 
kcalloc(nslabs, sizeof(*mem->slots), GFP_KERNEL);
463e862ac63ef27 Will Deacon       2021-07-20  947               if 
(!mem->slots) {
463e862ac63ef27 Will Deacon       2021-07-20  948                       
kfree(mem);
463e862ac63ef27 Will Deacon       2021-07-20  949                       return 
-ENOMEM;
463e862ac63ef27 Will Deacon       2021-07-20  950               }
463e862ac63ef27 Will Deacon       2021-07-20  951  
47bb420a6670ad3 Tianyu Lan        2022-06-17  952               mem->areas = 
kcalloc(nareas, sizeof(*mem->areas),
47bb420a6670ad3 Tianyu Lan        2022-06-17  953                               
     GFP_KERNEL);
47bb420a6670ad3 Tianyu Lan        2022-06-17  954               if 
(!mem->areas) {
47bb420a6670ad3 Tianyu Lan        2022-06-17  955                       
kfree(mem);
47bb420a6670ad3 Tianyu Lan        2022-06-17 @956                       
kfree(mem->slots);
47bb420a6670ad3 Tianyu Lan        2022-06-17  957                       return 
-ENOMEM;
47bb420a6670ad3 Tianyu Lan        2022-06-17  958               }
47bb420a6670ad3 Tianyu Lan        2022-06-17  959  
0b84e4f8b793eb4 Claire Chang      2021-06-19  960               
set_memory_decrypted((unsigned long)phys_to_virt(rmem->base),
0b84e4f8b793eb4 Claire Chang      2021-06-19  961                               
     rmem->size >> PAGE_SHIFT);
e15db62bc5648ab Christoph Hellwig 2022-06-01  962               
swiotlb_init_io_tlb_mem(mem, rmem->base, nslabs, SWIOTLB_FORCE,
47bb420a6670ad3 Tianyu Lan        2022-06-17  963                               
        false, nareas);
0b84e4f8b793eb4 Claire Chang      2021-06-19  964               mem->for_alloc 
= true;
0b84e4f8b793eb4 Claire Chang      2021-06-19  965  
0b84e4f8b793eb4 Claire Chang      2021-06-19  966               rmem->priv = 
mem;
0b84e4f8b793eb4 Claire Chang      2021-06-19  967  
35265899acef135 Robin Murphy      2022-01-24  968               
swiotlb_create_debugfs_files(mem, rmem->name);
0b84e4f8b793eb4 Claire Chang      2021-06-19  969       }
0b84e4f8b793eb4 Claire Chang      2021-06-19  970  
0b84e4f8b793eb4 Claire Chang      2021-06-19  971       dev->dma_io_tlb_mem = 
mem;
0b84e4f8b793eb4 Claire Chang      2021-06-19  972  
0b84e4f8b793eb4 Claire Chang      2021-06-19  973       return 0;
0b84e4f8b793eb4 Claire Chang      2021-06-19  974  }
0b84e4f8b793eb4 Claire Chang      2021-06-19  975  

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