Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [asahilinux:bits/020-dart 4/20] drivers/iommu/apple-dart.c:851:40: warning: shift count >= width of type
@ 2026-08-26  0:26 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-08-26  0:26 UTC (permalink / raw)
  To: Janne Grunau; +Cc: llvm, oe-kbuild-all, Hector Martin

tree:   https://github.com/AsahiLinux/linux bits/020-dart
head:   45b2aa771c5241177bad6c3f1777bb34871aa5ef
commit: 679ee8da9f5f0497de57348d1c60a8a856f411b2 [4/20] iommu: apple-dart: Support specifying the DMA aperture in the DT
config: i386-buildonly-randconfig-001-20260826 (https://download.01.org/0day-ci/archive/20260826/202608260806.OK7fHjwY-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260826/202608260806.OK7fHjwY-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/202608260806.OK7fHjwY-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/iommu/apple-dart.c:851:40: warning: shift count >= width of type [-Wshift-count-overflow]
     851 |                 dma_min = ((dma_addr_t)args->args[1] << 32) | args->args[2];
         |                                                      ^  ~~
   drivers/iommu/apple-dart.c:852:48: warning: shift count >= width of type [-Wshift-count-overflow]
     852 |                 dma_addr_t size = ((dma_addr_t)args->args[3] << 32) | args->args[4];
         |                                                              ^  ~~
   2 warnings generated.


vim +851 drivers/iommu/apple-dart.c

   831	
   832	static int apple_dart_of_xlate(struct device *dev,
   833				       const struct of_phandle_args *args)
   834	{
   835		struct apple_dart_master_cfg *cfg = dev_iommu_priv_get(dev);
   836		struct platform_device *iommu_pdev = of_find_device_by_node(args->np);
   837		struct apple_dart *dart = platform_get_drvdata(iommu_pdev);
   838		struct apple_dart *cfg_dart;
   839		dma_addr_t dma_max = DMA_BIT_MASK(dart->ias);
   840		dma_addr_t dma_min = 0;
   841		int i, sid;
   842	
   843		put_device(&iommu_pdev->dev);
   844	
   845		if (args->args_count != 1 && args->args_count != 5)
   846			return -EINVAL;
   847	
   848		sid = args->args[0];
   849	
   850		if (args->args_count == 5) {
 > 851			dma_min = ((dma_addr_t)args->args[1] << 32) | args->args[2];
   852			dma_addr_t size = ((dma_addr_t)args->args[3] << 32) | args->args[4];
   853			if (!(IS_ALIGNED(dma_min, dart->pgsize) || !IS_ALIGNED(size, dart->pgsize))) {
   854				dev_err(dev, "Unaligned DMA window %pad..%pad for page size 0x%x\n",
   855					&dma_min, &size, dart->pgsize);
   856				return -EINVAL;
   857			}
   858			dma_max = dma_min + size - 1;
   859			/*
   860			 * Ensure that the DMA window does not exceed the dart's ias.
   861			 */
   862			if ((dma_min ^ dma_max) & ~DMA_BIT_MASK(dart->ias)) {
   863				dev_err(dev, "Invalid DMA window for ias=%d\n",
   864					dart->ias);
   865				return -EINVAL;
   866			}
   867		}
   868	
   869		if (!cfg) {
   870			cfg = kzalloc_obj(*cfg);
   871			if (!cfg)
   872				return -ENOMEM;
   873			/* Will be ANDed with DART capabilities */
   874			cfg->supports_bypass = true;
   875			/* Will be merged with other DARTs to the to fully overlapping range. */
   876			cfg->dma_min = dma_min;
   877			cfg->dma_max = dma_max;
   878		} else {
   879			if (dma_min >= cfg->dma_max || cfg->dma_min >= dma_max) {
   880				dev_err(dev, "non-overlapping DMA windows: %pad..%pad, "
   881					"%pad..%pad\n", &dma_min, &dma_max,
   882					&cfg->dma_min, &cfg->dma_max);
   883				return -EINVAL;
   884			}
   885			cfg->dma_min = max(dma_min, cfg->dma_min);
   886			cfg->dma_max = min(dma_max, cfg->dma_max);
   887		}
   888		dev_iommu_priv_set(dev, cfg);
   889	
   890		cfg_dart = cfg->stream_maps[0].dart;
   891		if (cfg_dart) {
   892			if (cfg_dart->pgsize != dart->pgsize)
   893				return -EINVAL;
   894			if (cfg_dart->ias != dart->ias)
   895				return -EINVAL;
   896		}
   897	
   898		cfg->supports_bypass &= dart->supports_bypass;
   899	
   900		for (i = 0; i < MAX_DARTS_PER_DEVICE; ++i) {
   901			if (cfg->stream_maps[i].dart == dart) {
   902				set_bit(sid, cfg->stream_maps[i].sidmap);
   903				return 0;
   904			}
   905		}
   906		for (i = 0; i < MAX_DARTS_PER_DEVICE; ++i) {
   907			if (!cfg->stream_maps[i].dart) {
   908				cfg->stream_maps[i].dart = dart;
   909				set_bit(sid, cfg->stream_maps[i].sidmap);
   910				return 0;
   911			}
   912		}
   913	
   914		return -EINVAL;
   915	}
   916	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-26  0:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-26  0:26 [asahilinux:bits/020-dart 4/20] drivers/iommu/apple-dart.c:851:40: warning: shift count >= width of type kernel test robot

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