lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202208310701.LKr1WDCh-lkp@intel.com>
Date:   Wed, 31 Aug 2022 09:01:20 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Yu Zhao <yuzhao@...gle.com>,
        Christoph Hellwig <hch@...radead.org>,
        Marek Szyprowski <m.szyprowski@...sung.com>,
        Robin Murphy <robin.murphy@....com>,
        Dongli Zhang <dongli.zhang@...cle.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org, iommu@...ts.linux.dev,
        linux-kernel@...r.kernel.org, Yu Zhao <yuzhao@...gle.com>
Subject: Re: [PATCH] Revert "swiotlb: panic if nslabs is too small"

Hi Yu,

url:    https://github.com/intel-lab-lkp/linux/commits/Yu-Zhao/Revert-swiotlb-panic-if-nslabs-is-too-small/20220830-073123
base:   c40e8341e3b3bb27e3a65b06b5b454626234c4f0
config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220831/202208310701.LKr1WDCh-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
kernel/dma/swiotlb.c:334 swiotlb_init_remap() error: uninitialized symbol 'nslabs'.

vim +/nslabs +334 kernel/dma/swiotlb.c

7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  307  void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  308  		int (*remap)(void *tlb, unsigned long nslabs))
                                                                                                                              ^^^^^^

abbceff7d7a884 lib/swiotlb.c           FUJITA Tomonori   2010-05-10  309  {
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  310  	struct io_tlb_mem *mem = &io_tlb_default_mem;
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  311  	unsigned long nslabs;
                                                                                              ^^^^^^
Merge issue?  How does this compile?

a5e891321a2196 kernel/dma/swiotlb.c    Christoph Hellwig 2022-05-11  312  	size_t alloc_size;
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  313  	size_t bytes;
2d29960af0bee8 kernel/dma/swiotlb.c    Christoph Hellwig 2021-03-18  314  	void *tlb;
abbceff7d7a884 lib/swiotlb.c           FUJITA Tomonori   2010-05-10  315  
c6af2aa9ffc976 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-29  316  	if (!addressing_limit && !swiotlb_force_bounce)
c6af2aa9ffc976 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-29  317  		return;
c6af2aa9ffc976 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-29  318  	if (swiotlb_force_disable)
2726bf3ff2520d kernel/dma/swiotlb.c    Florian Fainelli  2021-03-22  319  		return;
2726bf3ff2520d kernel/dma/swiotlb.c    Florian Fainelli  2021-03-22  320  
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  321  	/*
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  322  	 * default_nslabs maybe changed when adjust area number.
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  323  	 * So allocate bounce buffer after adjusting area number.
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  324  	 */
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  325  	if (!default_nareas)
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  326  		swiotlb_adjust_nareas(num_possible_cpus());
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  327  
8ba2ed1be90fc2 kernel/dma/swiotlb.c    Christoph Hellwig 2022-02-28  328  	/*
8ba2ed1be90fc2 kernel/dma/swiotlb.c    Christoph Hellwig 2022-02-28  329  	 * By default allocate the bounce buffer memory from low memory, but
8ba2ed1be90fc2 kernel/dma/swiotlb.c    Christoph Hellwig 2022-02-28  330  	 * allow to pick a location everywhere for hypervisors with guest
8ba2ed1be90fc2 kernel/dma/swiotlb.c    Christoph Hellwig 2022-02-28  331  	 * memory encryption.
8ba2ed1be90fc2 kernel/dma/swiotlb.c    Christoph Hellwig 2022-02-28  332  	 */
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  333  retry:
a5e891321a2196 kernel/dma/swiotlb.c    Christoph Hellwig 2022-05-11 @334  	bytes = PAGE_ALIGN(nslabs << IO_TLB_SHIFT);
                                                                                                   ^^^^^^


8ba2ed1be90fc2 kernel/dma/swiotlb.c    Christoph Hellwig 2022-02-28  335  	if (flags & SWIOTLB_ANY)
8ba2ed1be90fc2 kernel/dma/swiotlb.c    Christoph Hellwig 2022-02-28  336  		tlb = memblock_alloc(bytes, PAGE_SIZE);
8ba2ed1be90fc2 kernel/dma/swiotlb.c    Christoph Hellwig 2022-02-28  337  	else
2d29960af0bee8 kernel/dma/swiotlb.c    Christoph Hellwig 2021-03-18  338  		tlb = memblock_alloc_low(bytes, PAGE_SIZE);
1521c607cabe7c kernel/dma/swiotlb.c    Christoph Hellwig 2022-05-11  339  	if (!tlb) {
b253fbc6b9640a kernel/dma/swiotlb.c    Yu Zhao           2022-08-29  340  		pr_warn("%s: failed to allocate tlb structure\n", __func__);
1521c607cabe7c kernel/dma/swiotlb.c    Christoph Hellwig 2022-05-11  341  		return;
1521c607cabe7c kernel/dma/swiotlb.c    Christoph Hellwig 2022-05-11  342  	}
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  343  
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  344  	if (remap && remap(tlb, nslabs) < 0) {
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  345  		memblock_free(tlb, PAGE_ALIGN(bytes));
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  346  
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  347  		nslabs = ALIGN(nslabs >> 1, IO_TLB_SEGSIZE);
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  348  		if (nslabs < IO_TLB_MIN_SLABS)
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  349  			panic("%s: Failed to remap %zu bytes\n",
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  350  			      __func__, bytes);
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  351  		goto retry;
7374153d294eb5 kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-14  352  	}
abbceff7d7a884 lib/swiotlb.c           FUJITA Tomonori   2010-05-10  353  
a5e891321a2196 kernel/dma/swiotlb.c    Christoph Hellwig 2022-05-11  354  	alloc_size = PAGE_ALIGN(array_size(sizeof(*mem->slots), nslabs));
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  355  	mem->slots = memblock_alloc(alloc_size, PAGE_SIZE);
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  356  	if (!mem->slots)
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  357  		panic("%s: Failed to allocate %zu bytes align=0x%lx\n",
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  358  		      __func__, alloc_size, PAGE_SIZE);
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  359  
72311809031217 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-21  360  	mem->areas = memblock_alloc(array_size(sizeof(struct io_tlb_area),
72311809031217 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-21  361  		default_nareas), SMP_CACHE_BYTES);
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  362  	if (!mem->areas)
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  363  		panic("%s: Failed to allocate mem->areas.\n", __func__);
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  364  
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  365  	swiotlb_init_io_tlb_mem(mem, __pa(tlb), nslabs, flags, false,
20347fca71a387 kernel/dma/swiotlb.c    Tianyu Lan        2022-07-08  366  				default_nareas);
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  367  
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  368  	if (flags & SWIOTLB_VERBOSE)
6424e31b1c050a kernel/dma/swiotlb.c    Christoph Hellwig 2022-03-15  369  		swiotlb_print_info();
^1da177e4c3f41 arch/ia64/lib/swiotlb.c Linus Torvalds    2005-04-16  370  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ