Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: [PATCH v1 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address
       [not found] <184fc9bda626efc62c5022ace01a20b80d1dc93b.1753003879.git.leon@kernel.org>
@ 2025-07-20 11:28 ` kernel test robot
  2025-07-20 13:10   ` Leon Romanovsky
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-07-20 11:28 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: llvm, oe-kbuild-all

Hi Leon,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20250718]
[cannot apply to linus/master v6.16-rc6 v6.16-rc5 v6.16-rc4 v6.16-rc6]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Leon-Romanovsky/dma-mapping-prepare-dma_map_ops-to-conversion-to-physical-address/20250720-173726
base:   next-20250718
patch link:    https://lore.kernel.org/r/184fc9bda626efc62c5022ace01a20b80d1dc93b.1753003879.git.leon%40kernel.org
patch subject: [PATCH v1 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address
config: s390-randconfig-001-20250720 (https://download.01.org/0day-ci/archive/20250720/202507201935.hwB4Ebxp-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 16534d19bf50bde879a83f0ae62875e2c5120e64)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250720/202507201935.hwB4Ebxp-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507201935.hwB4Ebxp-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> kernel/dma/mapping.c:192:12: warning: variable 'addr' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
     192 |                 else if (ops->map_page)
         |                          ^~~~~~~~~~~~~
   kernel/dma/mapping.c:198:32: note: uninitialized use occurs here
     198 |         trace_dma_map_phys(dev, phys, addr, size, dir, attrs);
         |                                       ^~~~
   kernel/dma/mapping.c:192:8: note: remove the 'if' if its condition is always true
     192 |                 else if (ops->map_page)
         |                      ^~~~~~~~~~~~~~~~~~
     193 |                         addr = ops->map_page(dev, page, offset, size, dir,
   kernel/dma/mapping.c:159:17: note: initialize the variable 'addr' to silence this warning
     159 |         dma_addr_t addr;
         |                        ^
         |                         = 0
   1 warning generated.


vim +192 kernel/dma/mapping.c

   154	
   155	dma_addr_t dma_map_phys(struct device *dev, phys_addr_t phys, size_t size,
   156			enum dma_data_direction dir, unsigned long attrs)
   157	{
   158		const struct dma_map_ops *ops = get_dma_ops(dev);
   159		dma_addr_t addr;
   160	
   161		BUG_ON(!valid_dma_direction(dir));
   162	
   163		if (WARN_ON_ONCE(!dev->dma_mask))
   164			return DMA_MAPPING_ERROR;
   165	
   166		if (dma_map_direct(dev, ops) ||
   167		    arch_dma_map_phys_direct(dev, phys + size))
   168			addr = dma_direct_map_phys(dev, phys, size, dir, attrs);
   169		else if (use_dma_iommu(dev))
   170			addr = iommu_dma_map_phys(dev, phys, size, dir, attrs);
   171		else {
   172			struct page *page = phys_to_page(phys);
   173			size_t offset = offset_in_page(phys);
   174			bool is_pfn_valid = true;
   175	
   176			if (IS_ENABLED(CONFIG_DMA_API_DEBUG)) {
   177				is_pfn_valid = pfn_valid(PHYS_PFN(phys));
   178	
   179				/* We shouldn't have both functions */
   180				WARN_ON_ONCE(ops->map_page && ops->map_phys);
   181			}
   182	
   183			if (unlikely(!is_pfn_valid))
   184				return DMA_MAPPING_ERROR;
   185	
   186			/*
   187			 * All platforms which implement .map_page() don't support
   188			 * non-struct page backed addresses.
   189			 */
   190			if (ops->map_phys)
   191				addr = ops->map_phys(dev, phys, size, dir, attrs);
 > 192			else if (ops->map_page)
   193				addr = ops->map_page(dev, page, offset, size, dir,
   194						     attrs);
   195		}
   196	
   197		kmsan_handle_dma(phys, size, dir);
   198		trace_dma_map_phys(dev, phys, addr, size, dir, attrs);
   199		debug_dma_map_phys(dev, phys, size, dir, addr, attrs);
   200	
   201		return addr;
   202	}
   203	EXPORT_SYMBOL_GPL(dma_map_phys);
   204	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address
  2025-07-20 11:28 ` [PATCH v1 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address kernel test robot
@ 2025-07-20 13:10   ` Leon Romanovsky
  0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2025-07-20 13:10 UTC (permalink / raw)
  To: kernel test robot; +Cc: llvm, oe-kbuild-all

On Sun, Jul 20, 2025 at 07:28:05PM +0800, kernel test robot wrote:
> Hi Leon,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on next-20250718]
> [cannot apply to linus/master v6.16-rc6 v6.16-rc5 v6.16-rc4 v6.16-rc6]
> [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#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Leon-Romanovsky/dma-mapping-prepare-dma_map_ops-to-conversion-to-physical-address/20250720-173726
> base:   next-20250718
> patch link:    https://lore.kernel.org/r/184fc9bda626efc62c5022ace01a20b80d1dc93b.1753003879.git.leon%40kernel.org
> patch subject: [PATCH v1 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address
> config: s390-randconfig-001-20250720 (https://download.01.org/0day-ci/archive/20250720/202507201935.hwB4Ebxp-lkp@intel.com/config)
> compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 16534d19bf50bde879a83f0ae62875e2c5120e64)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250720/202507201935.hwB4Ebxp-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202507201935.hwB4Ebxp-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> kernel/dma/mapping.c:192:12: warning: variable 'addr' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>      192 |                 else if (ops->map_page)
>          |                          ^~~~~~~~~~~~~
>    kernel/dma/mapping.c:198:32: note: uninitialized use occurs here
>      198 |         trace_dma_map_phys(dev, phys, addr, size, dir, attrs);
>          |                                       ^~~~
>    kernel/dma/mapping.c:192:8: note: remove the 'if' if its condition is always true
>      192 |                 else if (ops->map_page)
>          |                      ^~~~~~~~~~~~~~~~~~
>      193 |                         addr = ops->map_page(dev, page, offset, size, dir,
>    kernel/dma/mapping.c:159:17: note: initialize the variable 'addr' to silence this warning
>      159 |         dma_addr_t addr;
>          |                        ^
>          |                         = 0
>    1 warning generated.

Strange, I didn't get any warning about it for v1.

Thanks

> 
> 
> vim +192 kernel/dma/mapping.c
> 
>    154	
>    155	dma_addr_t dma_map_phys(struct device *dev, phys_addr_t phys, size_t size,
>    156			enum dma_data_direction dir, unsigned long attrs)
>    157	{
>    158		const struct dma_map_ops *ops = get_dma_ops(dev);
>    159		dma_addr_t addr;
>    160	
>    161		BUG_ON(!valid_dma_direction(dir));
>    162	
>    163		if (WARN_ON_ONCE(!dev->dma_mask))
>    164			return DMA_MAPPING_ERROR;
>    165	
>    166		if (dma_map_direct(dev, ops) ||
>    167		    arch_dma_map_phys_direct(dev, phys + size))
>    168			addr = dma_direct_map_phys(dev, phys, size, dir, attrs);
>    169		else if (use_dma_iommu(dev))
>    170			addr = iommu_dma_map_phys(dev, phys, size, dir, attrs);
>    171		else {
>    172			struct page *page = phys_to_page(phys);
>    173			size_t offset = offset_in_page(phys);
>    174			bool is_pfn_valid = true;
>    175	
>    176			if (IS_ENABLED(CONFIG_DMA_API_DEBUG)) {
>    177				is_pfn_valid = pfn_valid(PHYS_PFN(phys));
>    178	
>    179				/* We shouldn't have both functions */
>    180				WARN_ON_ONCE(ops->map_page && ops->map_phys);
>    181			}
>    182	
>    183			if (unlikely(!is_pfn_valid))
>    184				return DMA_MAPPING_ERROR;
>    185	
>    186			/*
>    187			 * All platforms which implement .map_page() don't support
>    188			 * non-struct page backed addresses.
>    189			 */
>    190			if (ops->map_phys)
>    191				addr = ops->map_phys(dev, phys, size, dir, attrs);
>  > 192			else if (ops->map_page)
>    193				addr = ops->map_page(dev, page, offset, size, dir,
>    194						     attrs);
>    195		}
>    196	
>    197		kmsan_handle_dma(phys, size, dir);
>    198		trace_dma_map_phys(dev, phys, addr, size, dir, attrs);
>    199		debug_dma_map_phys(dev, phys, size, dir, addr, attrs);
>    200	
>    201		return addr;
>    202	}
>    203	EXPORT_SYMBOL_GPL(dma_map_phys);
>    204	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-20 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <184fc9bda626efc62c5022ace01a20b80d1dc93b.1753003879.git.leon@kernel.org>
2025-07-20 11:28 ` [PATCH v1 1/2] dma-mapping: prepare dma_map_ops to conversion to physical address kernel test robot
2025-07-20 13:10   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox