Messages in this thread | | | Date | Tue, 17 Aug 2021 07:48:50 +0800 | From | kernel test robot <> | Subject | [linux-rt-devel:linux-5.14.y-rt-rebase 184/245] mm/vmalloc.c:1887:2: warning: Value stored to 'cpu' is never read [clang-analyzer-deadcode.DeadStores] |
| |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-5.14.y-rt-rebase head: 0eead4e5a60cb716ec911a552787a69332cf6943 commit: 9584df5e521f3b4e0a2063d7878762f7aa54fca5 [184/245] mm/vmalloc: Another preempt disable region which sucks config: riscv-randconfig-c006-20210816 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 44d0a99a12ec7ead4d2f5ef649ba05b40f6d463d) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/commit/?id=9584df5e521f3b4e0a2063d7878762f7aa54fca5 git remote add linux-rt-devel https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git git fetch --no-tags linux-rt-devel linux-5.14.y-rt-rebase git checkout 9584df5e521f3b4e0a2063d7878762f7aa54fca5 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com>
clang-analyzer warnings: (new ones prefixed by >>) ^~~~~ include/asm-generic/bitops/fls.h:17:6: note: Assuming 'x' is not equal to 0, which participates in a condition later if (!x) ^~ include/asm-generic/bitops/fls.h:17:2: note: Taking false branch if (!x) ^ include/asm-generic/bitops/fls.h:19:6: note: Assuming the condition is false if (!(x & 0xffff0000u)) { ^~~~~~~~~~~~~~~~~~ include/asm-generic/bitops/fls.h:19:2: note: Taking false branch if (!(x & 0xffff0000u)) { ^ include/asm-generic/bitops/fls.h:23:6: note: Assuming the condition is false if (!(x & 0xff000000u)) { ^~~~~~~~~~~~~~~~~~ include/asm-generic/bitops/fls.h:23:2: note: Taking false branch if (!(x & 0xff000000u)) { ^ include/asm-generic/bitops/fls.h:27:6: note: Assuming the condition is false if (!(x & 0xf0000000u)) { ^~~~~~~~~~~~~~~~~~ include/asm-generic/bitops/fls.h:27:2: note: Taking false branch if (!(x & 0xf0000000u)) { ^ include/asm-generic/bitops/fls.h:31:6: note: Assuming the condition is false if (!(x & 0xc0000000u)) { ^~~~~~~~~~~~~~~~~~ include/asm-generic/bitops/fls.h:31:2: note: Taking false branch if (!(x & 0xc0000000u)) { ^ include/asm-generic/bitops/fls.h:35:6: note: Assuming the condition is false if (!(x & 0x80000000u)) { ^~~~~~~~~~~~~~~~~~ include/asm-generic/bitops/fls.h:35:2: note: Taking false branch if (!(x & 0x80000000u)) { ^ include/asm-generic/bitops/fls.h:39:2: note: Returning the value 32 (loaded from 'r') return r; ^~~~~~~~ include/linux/bitops.h:188:10: note: Returning from 'fls' return fls(l); ^~~~~~ include/linux/bitops.h:188:3: note: Returning the value 32 return fls(l); ^~~~~~~~~~~~~ include/linux/log2.h:57:16: note: Returning from 'fls_long' return 1UL << fls_long(n - 1); ^~~~~~~~~~~~~~~ include/linux/log2.h:57:13: note: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned long' return 1UL << fls_long(n - 1); ^ ~~~~~~~~~~~~~~~ Suppressed 14 warnings (14 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (9 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (9 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (9 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (9 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (9 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (9 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. Suppressed 8 warnings (8 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (9 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 8 warnings generated. Suppressed 8 warnings (8 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (9 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (9 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 17 warnings generated. mm/vmalloc.c:285:2: warning: Value stored to 'start' is never read [clang-analyzer-deadcode.DeadStores] start = addr; ^ ~~~~ mm/vmalloc.c:285:2: note: Value stored to 'start' is never read start = addr; ^ ~~~~ mm/vmalloc.c:568:18: warning: Value stored to 'nr' during its initialization is never read [clang-analyzer-deadcode.DeadStores] unsigned int i, nr = (end - addr) >> PAGE_SHIFT; ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ mm/vmalloc.c:568:18: note: Value stored to 'nr' during its initialization is never read unsigned int i, nr = (end - addr) >> PAGE_SHIFT; ^~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ >> mm/vmalloc.c:1887:2: warning: Value stored to 'cpu' is never read [clang-analyzer-deadcode.DeadStores] cpu = get_cpu_light(); ^ mm/vmalloc.c:1887:2: note: Value stored to 'cpu' is never read mm/vmalloc.c:1972:2: warning: Value stored to 'cpu' is never read [clang-analyzer-deadcode.DeadStores] cpu = get_cpu_light(); ^ mm/vmalloc.c:1972:2: note: Value stored to 'cpu' is never read mm/vmalloc.c:1978:23: warning: The result of the left shift is undefined due to shifting by '32', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult] if (vb->free < (1UL << order)) { ^ ~~~~~ mm/vmalloc.c:1959:2: note: Assuming the condition is true BUG_ON(offset_in_page(size)); ^ include/asm-generic/bug.h:65:36: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:78:40: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^~~~ mm/vmalloc.c:1959:2: note: Taking false branch BUG_ON(offset_in_page(size)); ^ include/asm-generic/bug.h:65:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ mm/vmalloc.c:1959:2: note: Loop condition is false. Exiting loop BUG_ON(offset_in_page(size)); ^ include/asm-generic/bug.h:65:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ mm/vmalloc.c:1960:9: note: Assuming the condition is false BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC); ^ include/asm-generic/bug.h:65:45: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ~~~~~~~~~^~~~~~~~~~ include/linux/compiler.h:78:42: note: expanded from macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ mm/vmalloc.c:1960:2: note: Taking false branch BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC); ^ include/asm-generic/bug.h:65:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ mm/vmalloc.c:1960:2: note: Loop condition is false. Exiting loop BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC); ^ include/asm-generic/bug.h:65:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ mm/vmalloc.c:1961:14: note: Assuming 'size' is not equal to 0 if (WARN_ON(size == 0)) { ^ include/asm-generic/bug.h:121:25: note: expanded from macro 'WARN_ON' int __ret_warn_on = !!(condition); \ ^~~~~~~~~ mm/vmalloc.c:1961:6: note: Taking false branch if (WARN_ON(size == 0)) { ^ include/asm-generic/bug.h:122:2: note: expanded from macro 'WARN_ON' if (unlikely(__ret_warn_on)) \ ^ mm/vmalloc.c:1961:2: note: Taking false branch if (WARN_ON(size == 0)) { ^ mm/vmalloc.c:1969:10: note: Calling 'get_order' order = get_order(size); ^~~~~~~~~~~~~~~ include/asm-generic/getorder.h:31:2: note: Taking false branch if (__builtin_constant_p(size)) { ^ include/asm-generic/getorder.h:44:9: note: Calling 'fls' return fls(size); ^~~~~~~~~ include/asm-generic/bitops/fls.h:15:2: note: 'r' initialized to 32 int r = 32; ^~~~~ include/asm-generic/bitops/fls.h:17:6: note: Assuming 'x' is not equal to 0, which participates in a condition later if (!x) ^~ include/asm-generic/bitops/fls.h:17:2: note: Taking false branch if (!x) ^ include/asm-generic/bitops/fls.h:19:6: note: Assuming the condition is false if (!(x & 0xffff0000u)) { ^~~~~~~~~~~~~~~~~~ include/asm-generic/bitops/fls.h:19:2: note: Taking false branch if (!(x & 0xffff0000u)) { ^ include/asm-generic/bitops/fls.h:23:6: note: Assuming the condition is false if (!(x & 0xff000000u)) { ^~~~~~~~~~~~~~~~~~ include/asm-generic/bitops/fls.h:23:2: note: Taking false branch if (!(x & 0xff000000u)) { ^ include/asm-generic/bitops/fls.h:27:6: note: Assuming the condition is false if (!(x & 0xf0000000u)) { ^~~~~~~~~~~~~~~~~~
vim +/cpu +1887 mm/vmalloc.c
1835 1836 /** 1837 * new_vmap_block - allocates new vmap_block and occupies 2^order pages in this 1838 * block. Of course pages number can't exceed VMAP_BBMAP_BITS 1839 * @order: how many 2^order pages should be occupied in newly allocated block 1840 * @gfp_mask: flags for the page level allocator 1841 * 1842 * Return: virtual address in a newly allocated block or ERR_PTR(-errno) 1843 */ 1844 static void *new_vmap_block(unsigned int order, gfp_t gfp_mask) 1845 { 1846 struct vmap_block_queue *vbq; 1847 struct vmap_block *vb; 1848 struct vmap_area *va; 1849 unsigned long vb_idx; 1850 int node, err, cpu; 1851 void *vaddr; 1852 1853 node = numa_node_id(); 1854 1855 vb = kmalloc_node(sizeof(struct vmap_block), 1856 gfp_mask & GFP_RECLAIM_MASK, node); 1857 if (unlikely(!vb)) 1858 return ERR_PTR(-ENOMEM); 1859 1860 va = alloc_vmap_area(VMAP_BLOCK_SIZE, VMAP_BLOCK_SIZE, 1861 VMALLOC_START, VMALLOC_END, 1862 node, gfp_mask); 1863 if (IS_ERR(va)) { 1864 kfree(vb); 1865 return ERR_CAST(va); 1866 } 1867 1868 vaddr = vmap_block_vaddr(va->va_start, 0); 1869 spin_lock_init(&vb->lock); 1870 vb->va = va; 1871 /* At least something should be left free */ 1872 BUG_ON(VMAP_BBMAP_BITS <= (1UL << order)); 1873 vb->free = VMAP_BBMAP_BITS - (1UL << order); 1874 vb->dirty = 0; 1875 vb->dirty_min = VMAP_BBMAP_BITS; 1876 vb->dirty_max = 0; 1877 INIT_LIST_HEAD(&vb->free_list); 1878 1879 vb_idx = addr_to_vb_idx(va->va_start); 1880 err = xa_insert(&vmap_blocks, vb_idx, vb, gfp_mask); 1881 if (err) { 1882 kfree(vb); 1883 free_vmap_area(va); 1884 return ERR_PTR(err); 1885 } 1886 > 1887 cpu = get_cpu_light(); 1888 vbq = this_cpu_ptr(&vmap_block_queue); 1889 spin_lock(&vbq->lock); 1890 list_add_tail_rcu(&vb->free_list, &vbq->free); 1891 spin_unlock(&vbq->lock); 1892 put_cpu_light(); 1893 1894 return vaddr; 1895 } 1896
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] | |