:::::: :::::: Manual check reason: "low confidence static check first_new_problem: drivers/iommu/iova.c:185:14: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign]" :::::: BCC: lkp@intel.com CC: llvm@lists.linux.dev CC: oe-kbuild-all@lists.linux.dev CC: linux-kernel@vger.kernel.org TO: Dmitry Osipenko CC: Mauro Carvalho Chehab CC: linux-media@vger.kernel.org CC: Hans Verkuil tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 1b929c02afd37871d5afb9d498426f83432e71c2 commit: 8bd4aaf438e39f88e4321e0cad2d42284c2269af media: staging: tegra-vde: De-stage driver date: 10 months ago :::::: branch date: 11 hours ago :::::: commit date: 10 months ago config: riscv-randconfig-c006-20221220 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 98b13979fb05f3ed288a900deb843e7b27589e58) 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/torvalds/linux.git/commit/?id=8bd4aaf438e39f88e4321e0cad2d42284c2269af git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 8bd4aaf438e39f88e4321e0cad2d42284c2269af # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot clang_analyzer warnings: (new ones prefixed by >>) BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:54:2: note: Loop condition is false. Exiting loop BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:56:2: note: Loop condition is false. Exiting loop spin_lock_init(&iovad->iova_rbtree_lock); ^ include/linux/spinlock.h:329:35: note: expanded from macro 'spin_lock_init' # define spin_lock_init(lock) \ ^ drivers/iommu/iova.c:62:29: note: The result of the left shift is undefined due to shifting by '18446744073709551613', which is greater or equal to the width of type 'unsigned long' iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:62:29: warning: The result of the left shift is undefined due to shifting by '18446744073709551614', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult] iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:54:10: note: Assuming the condition is false BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:45: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ~~~~~~~~~^~~~~~~~~~ include/linux/compiler.h:48:41: note: expanded from macro 'unlikely' # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x))) ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__' ______r = __builtin_expect(!!(x), expect); \ ^ drivers/iommu/iova.c:54:9: note: Left side of '||' is false BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ drivers/iommu/iova.c:54:9: note: Left side of '||' is false drivers/iommu/iova.c:54:2: note: Taking false branch BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:54:2: note: Loop condition is false. Exiting loop BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:56:2: note: Loop condition is false. Exiting loop spin_lock_init(&iovad->iova_rbtree_lock); ^ include/linux/spinlock.h:329:35: note: expanded from macro 'spin_lock_init' # define spin_lock_init(lock) \ ^ drivers/iommu/iova.c:62:29: note: The result of the left shift is undefined due to shifting by '18446744073709551614', which is greater or equal to the width of type 'unsigned long' iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:62:29: warning: The result of the left shift is undefined due to shifting by '18446744073709551615', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult] iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:54:10: note: Assuming the condition is false BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:45: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ~~~~~~~~~^~~~~~~~~~ include/linux/compiler.h:48:41: note: expanded from macro 'unlikely' # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x))) ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__' ______r = __builtin_expect(!!(x), expect); \ ^ drivers/iommu/iova.c:54:9: note: Left side of '||' is false BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ drivers/iommu/iova.c:54:9: note: Left side of '||' is false drivers/iommu/iova.c:54:2: note: Taking false branch BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:54:2: note: Loop condition is false. Exiting loop BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:56:2: note: Loop condition is false. Exiting loop spin_lock_init(&iovad->iova_rbtree_lock); ^ include/linux/spinlock.h:329:35: note: expanded from macro 'spin_lock_init' # define spin_lock_init(lock) \ ^ drivers/iommu/iova.c:62:29: note: The result of the left shift is undefined due to shifting by '18446744073709551615', which is greater or equal to the width of type 'unsigned long' iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/iommu/iova.c:185:14: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] align_mask <<= fls_long(size - 1); ^ drivers/iommu/iova.c:446:6: note: Assuming the condition is false if (size < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:446:2: note: Taking false branch if (size < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) ^ drivers/iommu/iova.c:450:6: note: 'iova_pfn' is 0 if (iova_pfn) ^~~~~~~~ drivers/iommu/iova.c:450:2: note: Taking false branch if (iova_pfn) ^ drivers/iommu/iova.c:454:13: note: Calling 'alloc_iova' new_iova = alloc_iova(iovad, size, limit_pfn, true); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:317:6: note: Assuming 'new_iova' is non-null if (!new_iova) ^~~~~~~~~ drivers/iommu/iova.c:317:2: note: Taking false branch if (!new_iova) ^ drivers/iommu/iova.c:320:8: note: Calling '__alloc_and_insert_iova_range' ret = __alloc_and_insert_iova_range(iovad, size, limit_pfn + 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:184:6: note: 'size_aligned' is true if (size_aligned) ^~~~~~~~~~~~ drivers/iommu/iova.c:184:2: note: Taking true branch if (size_aligned) ^ drivers/iommu/iova.c:185:18: note: Calling 'fls_long' align_mask <<= fls_long(size - 1); ^~~~~~~~~~~~~~~~~~ include/linux/bitops.h:154:2: note: Taking false branch if (sizeof(l) == 4) ^ include/linux/bitops.h:156:9: note: Calling 'fls64' return fls64(l); ^~~~~~~~ include/asm-generic/bitops/fls64.h:29:6: note: 'x' is not equal to 0 if (x == 0) ^ include/asm-generic/bitops/fls64.h:29:2: note: Taking false branch if (x == 0) ^ include/asm-generic/bitops/fls64.h:31:2: note: Returning the value 64 return __fls(x) + 1; ^~~~~~~~~~~~~~~~~~~ include/linux/bitops.h:156:9: note: Returning from 'fls64' return fls64(l); ^~~~~~~~ include/linux/bitops.h:156:2: note: Returning the value 64 return fls64(l); ^~~~~~~~~~~~~~~ drivers/iommu/iova.c:185:18: note: Returning from 'fls_long' align_mask <<= fls_long(size - 1); ^~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:185:14: note: Assigned value is garbage or undefined align_mask <<= fls_long(size - 1); ^ ~~~~~~~~~~~~~~~~~~ include/linux/log2.h:57:13: warning: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult] return 1UL << fls_long(n - 1); ^ drivers/iommu/iova.c:446:6: note: Assuming the condition is true if (size < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:446:2: note: Taking true branch if (size < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) ^ drivers/iommu/iova.c:447:10: note: '?' condition is false size = roundup_pow_of_two(size); ^ include/linux/log2.h:176:2: note: expanded from macro 'roundup_pow_of_two' __builtin_constant_p(n) ? ( \ ^ drivers/iommu/iova.c:447:10: note: Calling '__roundup_pow_of_two' size = roundup_pow_of_two(size); ^ include/linux/log2.h:180:2: note: expanded from macro 'roundup_pow_of_two' __roundup_pow_of_two(n) \ ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/log2.h:57:16: note: Calling 'fls_long' return 1UL << fls_long(n - 1); ^~~~~~~~~~~~~~~ include/linux/bitops.h:154:2: note: Taking false branch if (sizeof(l) == 4) ^ include/linux/bitops.h:156:9: note: Calling 'fls64' return fls64(l); ^~~~~~~~ include/asm-generic/bitops/fls64.h:29:6: note: Assuming 'x' is not equal to 0 if (x == 0) ^~~~~~ include/asm-generic/bitops/fls64.h:29:2: note: Taking false branch if (x == 0) ^ include/asm-generic/bitops/fls64.h:31:2: note: Returning the value 64 return __fls(x) + 1; -- BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:54:2: note: Loop condition is false. Exiting loop BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:56:2: note: Loop condition is false. Exiting loop spin_lock_init(&iovad->iova_rbtree_lock); ^ include/linux/spinlock.h:329:35: note: expanded from macro 'spin_lock_init' # define spin_lock_init(lock) \ ^ drivers/iommu/iova.c:62:29: note: The result of the left shift is undefined due to shifting by '18446744073709551613', which is greater or equal to the width of type 'unsigned long' iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:62:29: warning: The result of the left shift is undefined due to shifting by '18446744073709551614', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult] iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:54:10: note: Assuming the condition is false BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:45: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ~~~~~~~~~^~~~~~~~~~ include/linux/compiler.h:48:41: note: expanded from macro 'unlikely' # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x))) ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__' ______r = __builtin_expect(!!(x), expect); \ ^ drivers/iommu/iova.c:54:9: note: Left side of '||' is false BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ drivers/iommu/iova.c:54:9: note: Left side of '||' is false drivers/iommu/iova.c:54:2: note: Taking false branch BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:54:2: note: Loop condition is false. Exiting loop BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:56:2: note: Loop condition is false. Exiting loop spin_lock_init(&iovad->iova_rbtree_lock); ^ include/linux/spinlock.h:329:35: note: expanded from macro 'spin_lock_init' # define spin_lock_init(lock) \ ^ drivers/iommu/iova.c:62:29: note: The result of the left shift is undefined due to shifting by '18446744073709551614', which is greater or equal to the width of type 'unsigned long' iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:62:29: warning: The result of the left shift is undefined due to shifting by '18446744073709551615', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult] iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:54:10: note: Assuming the condition is false BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:45: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ~~~~~~~~~^~~~~~~~~~ include/linux/compiler.h:48:41: note: expanded from macro 'unlikely' # define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x))) ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:33:34: note: expanded from macro '__branch_check__' ______r = __builtin_expect(!!(x), expect); \ ^ drivers/iommu/iova.c:54:9: note: Left side of '||' is false BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ drivers/iommu/iova.c:54:9: note: Left side of '||' is false drivers/iommu/iova.c:54:2: note: Taking false branch BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:32: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:54:2: note: Loop condition is false. Exiting loop BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); ^ include/asm-generic/bug.h:161:27: note: expanded from macro 'BUG_ON' #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) ^ drivers/iommu/iova.c:56:2: note: Loop condition is false. Exiting loop spin_lock_init(&iovad->iova_rbtree_lock); ^ include/linux/spinlock.h:329:35: note: expanded from macro 'spin_lock_init' # define spin_lock_init(lock) \ ^ drivers/iommu/iova.c:62:29: note: The result of the left shift is undefined due to shifting by '18446744073709551615', which is greater or equal to the width of type 'unsigned long' iovad->dma_32bit_pfn = 1UL << (32 - iova_shift(iovad)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/iommu/iova.c:185:14: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] align_mask <<= fls_long(size - 1); ^ drivers/iommu/iova.c:446:6: note: Assuming the condition is false if (size < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:446:2: note: Taking false branch if (size < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) ^ drivers/iommu/iova.c:450:6: note: 'iova_pfn' is 0 if (iova_pfn) ^~~~~~~~ drivers/iommu/iova.c:450:2: note: Taking false branch if (iova_pfn) ^ drivers/iommu/iova.c:454:13: note: Calling 'alloc_iova' new_iova = alloc_iova(iovad, size, limit_pfn, true); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:317:6: note: Assuming 'new_iova' is non-null if (!new_iova) ^~~~~~~~~ drivers/iommu/iova.c:317:2: note: Taking false branch if (!new_iova) ^ drivers/iommu/iova.c:320:8: note: Calling '__alloc_and_insert_iova_range' ret = __alloc_and_insert_iova_range(iovad, size, limit_pfn + 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:184:6: note: 'size_aligned' is true if (size_aligned) ^~~~~~~~~~~~ drivers/iommu/iova.c:184:2: note: Taking true branch if (size_aligned) ^ drivers/iommu/iova.c:185:18: note: Calling 'fls_long' align_mask <<= fls_long(size - 1); ^~~~~~~~~~~~~~~~~~ include/linux/bitops.h:154:2: note: Taking false branch if (sizeof(l) == 4) ^ include/linux/bitops.h:156:9: note: Calling 'fls64' return fls64(l); ^~~~~~~~ include/asm-generic/bitops/fls64.h:29:6: note: 'x' is not equal to 0 if (x == 0) ^ include/asm-generic/bitops/fls64.h:29:2: note: Taking false branch if (x == 0) ^ include/asm-generic/bitops/fls64.h:31:2: note: Returning the value 64 return __fls(x) + 1; ^~~~~~~~~~~~~~~~~~~ include/linux/bitops.h:156:9: note: Returning from 'fls64' return fls64(l); ^~~~~~~~ include/linux/bitops.h:156:2: note: Returning the value 64 return fls64(l); ^~~~~~~~~~~~~~~ drivers/iommu/iova.c:185:18: note: Returning from 'fls_long' align_mask <<= fls_long(size - 1); ^~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:185:14: note: Assigned value is garbage or undefined align_mask <<= fls_long(size - 1); ^ ~~~~~~~~~~~~~~~~~~ include/linux/log2.h:57:13: warning: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult] return 1UL << fls_long(n - 1); ^ drivers/iommu/iova.c:446:6: note: Assuming the condition is true if (size < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iova.c:446:2: note: Taking true branch if (size < (1 << (IOVA_RANGE_CACHE_MAX_SIZE - 1))) ^ drivers/iommu/iova.c:447:10: note: '?' condition is false size = roundup_pow_of_two(size); ^ include/linux/log2.h:176:2: note: expanded from macro 'roundup_pow_of_two' __builtin_constant_p(n) ? ( \ ^ drivers/iommu/iova.c:447:10: note: Calling '__roundup_pow_of_two' size = roundup_pow_of_two(size); ^ include/linux/log2.h:180:2: note: expanded from macro 'roundup_pow_of_two' __roundup_pow_of_two(n) \ ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/log2.h:57:16: note: Calling 'fls_long' return 1UL << fls_long(n - 1); ^~~~~~~~~~~~~~~ include/linux/bitops.h:154:2: note: Taking false branch if (sizeof(l) == 4) ^ include/linux/bitops.h:156:9: note: Calling 'fls64' return fls64(l); ^~~~~~~~ include/asm-generic/bitops/fls64.h:29:6: note: Assuming 'x' is not equal to 0 if (x == 0) ^~~~~~ include/asm-generic/bitops/fls64.h:29:2: note: Taking false branch if (x == 0) ^ include/asm-generic/bitops/fls64.h:31:2: note: Returning the value 64 return __fls(x) + 1; vim +185 drivers/iommu/iova.c d751751a9f7f2f drivers/iommu/iova.c Marek Szyprowski 2017-02-24 172 ddf02886cbe665 drivers/pci/iova.c mark gross 2008-03-04 173 static int __alloc_and_insert_iova_range(struct iova_domain *iovad, ddf02886cbe665 drivers/pci/iova.c mark gross 2008-03-04 174 unsigned long size, unsigned long limit_pfn, ddf02886cbe665 drivers/pci/iova.c mark gross 2008-03-04 175 struct iova *new, bool size_aligned) f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 176 { 973f5fbedb0721 drivers/iommu/iova.c Robin Murphy 2017-09-21 177 struct rb_node *curr, *prev; 973f5fbedb0721 drivers/iommu/iova.c Robin Murphy 2017-09-21 178 struct iova *curr_iova; f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 179 unsigned long flags; 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 180 unsigned long new_pfn, retry_pfn; 086c83acb70fc6 drivers/iommu/iova.c Zhen Lei 2017-09-21 181 unsigned long align_mask = ~0UL; 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 182 unsigned long high_pfn = limit_pfn, low_pfn = iovad->start_pfn; 086c83acb70fc6 drivers/iommu/iova.c Zhen Lei 2017-09-21 183 086c83acb70fc6 drivers/iommu/iova.c Zhen Lei 2017-09-21 184 if (size_aligned) 086c83acb70fc6 drivers/iommu/iova.c Zhen Lei 2017-09-21 @185 align_mask <<= fls_long(size - 1); f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 186 f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 187 /* Walk the tree backwards */ f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 188 spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); bee60e94a1e20e drivers/iommu/iova.c Ganapatrao Kulkarni 2018-09-05 189 if (limit_pfn <= iovad->dma_32bit_pfn && bee60e94a1e20e drivers/iommu/iova.c Ganapatrao Kulkarni 2018-09-05 190 size >= iovad->max32_alloc_size) bee60e94a1e20e drivers/iommu/iova.c Ganapatrao Kulkarni 2018-09-05 191 goto iova32_full; bee60e94a1e20e drivers/iommu/iova.c Ganapatrao Kulkarni 2018-09-05 192 973f5fbedb0721 drivers/iommu/iova.c Robin Murphy 2017-09-21 193 curr = __get_cached_rbnode(iovad, limit_pfn); 7ae31cec5b70e3 drivers/iommu/iova.c Robin Murphy 2021-03-05 194 curr_iova = to_iova(curr); 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 195 retry_pfn = curr_iova->pfn_hi + 1; 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 196 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 197 retry: 973f5fbedb0721 drivers/iommu/iova.c Robin Murphy 2017-09-21 198 do { 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 199 high_pfn = min(high_pfn, curr_iova->pfn_lo); 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 200 new_pfn = (high_pfn - size) & align_mask; ddf02886cbe665 drivers/pci/iova.c mark gross 2008-03-04 201 prev = curr; f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 202 curr = rb_prev(curr); 7ae31cec5b70e3 drivers/iommu/iova.c Robin Murphy 2021-03-05 203 curr_iova = to_iova(curr); 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 204 } while (curr && new_pfn <= curr_iova->pfn_hi && new_pfn >= low_pfn); f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 205 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 206 if (high_pfn < size || new_pfn < low_pfn) { 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 207 if (low_pfn == iovad->start_pfn && retry_pfn < limit_pfn) { 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 208 high_pfn = limit_pfn; 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 209 low_pfn = retry_pfn; 371d7955e3102f drivers/iommu/iova.c Robin Murphy 2021-03-05 210 curr = iova_find_limit(iovad, limit_pfn); 7ae31cec5b70e3 drivers/iommu/iova.c Robin Murphy 2021-03-05 211 curr_iova = to_iova(curr); 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 212 goto retry; 4e89dce725213d drivers/iommu/iova.c Vijayanand Jitta 2020-09-30 213 } 80ef4464d5e274 drivers/iommu/iova.c Robert Richter 2019-03-20 214 iovad->max32_alloc_size = size; bee60e94a1e20e drivers/iommu/iova.c Ganapatrao Kulkarni 2018-09-05 215 goto iova32_full; 80ef4464d5e274 drivers/iommu/iova.c Robert Richter 2019-03-20 216 } f76aec76ec7f68 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 217 f76aec76ec7f68 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 218 /* pfn_lo will point to size aligned address if size_aligned is set */ 086c83acb70fc6 drivers/iommu/iova.c Zhen Lei 2017-09-21 219 new->pfn_lo = new_pfn; f76aec76ec7f68 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 220 new->pfn_hi = new->pfn_lo + size - 1; f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 221 d751751a9f7f2f drivers/iommu/iova.c Marek Szyprowski 2017-02-24 222 /* If we have 'prev', it's a valid place to start the insertion. */ d751751a9f7f2f drivers/iommu/iova.c Marek Szyprowski 2017-02-24 223 iova_insert_rbtree(&iovad->rbroot, new, prev); e60aa7b53845a2 drivers/iommu/iova.c Robin Murphy 2017-09-21 224 __cached_rbnode_insert_update(iovad, new); ddf02886cbe665 drivers/pci/iova.c mark gross 2008-03-04 225 f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 226 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 227 return 0; bee60e94a1e20e drivers/iommu/iova.c Ganapatrao Kulkarni 2018-09-05 228 bee60e94a1e20e drivers/iommu/iova.c Ganapatrao Kulkarni 2018-09-05 229 iova32_full: bee60e94a1e20e drivers/iommu/iova.c Ganapatrao Kulkarni 2018-09-05 230 spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); bee60e94a1e20e drivers/iommu/iova.c Ganapatrao Kulkarni 2018-09-05 231 return -ENOMEM; f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 232 } f8de50eb6b0855 drivers/pci/iova.c Keshavamurthy, Anil S 2007-10-21 233 :::::: The code at line 185 was first introduced by commit :::::: 086c83acb70fc6da044c9ca45c1c9780c64545b0 iommu/iova: Optimise the padding calculation :::::: TO: Zhen Lei :::::: CC: Joerg Roedel -- 0-DAY CI Kernel Test Service https://01.org/lkp