kernel/iomem.c:18:32: sparse: sparse: cast truncates bits from constant value (38400000050e becomes 50e)

From: kernel test robot
Date: Sun Jul 28 2024 - 03:46:12 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5437f30d3458ad36e83ab96088d490ebfee844d8
commit: 0453c9a78015cb2219cda7239d881f4e3137bff8 sh: mm: convert to GENERIC_IOREMAP
date: 12 months ago
config: sh-randconfig-r133-20240727 (https://download.01.org/0day-ci/archive/20240728/202407281541.d1dk2Bne-lkp@xxxxxxxxx/config)
compiler: sh4-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240728/202407281541.d1dk2Bne-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407281541.d1dk2Bne-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
kernel/iomem.c:113:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *[assigned] addr @@ got void [noderef] __iomem * @@
kernel/iomem.c:113:22: sparse: expected void *[assigned] addr
kernel/iomem.c:113:22: sparse: got void [noderef] __iomem *
kernel/iomem.c:116:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *[assigned] addr @@ got void [noderef] __iomem * @@
kernel/iomem.c:116:22: sparse: expected void *[assigned] addr
kernel/iomem.c:116:22: sparse: got void [noderef] __iomem *
>> kernel/iomem.c:18:32: sparse: sparse: cast truncates bits from constant value (38400000050e becomes 50e)
kernel/iomem.c: note: in included file (through include/linux/gfp.h, include/linux/xarray.h, include/linux/radix-tree.h, ...):
include/linux/mmzone.h:1997:40: sparse: sparse: self-comparison always evaluates to false
--
arch/sh/boards/board-sh7785lcr.c:298:13: sparse: sparse: symbol 'init_sh7785lcr_IRQ' was not declared. Should it be static?
arch/sh/boards/board-sh7785lcr.c:322:11: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned char *p @@ got void [noderef] __iomem * @@
arch/sh/boards/board-sh7785lcr.c:322:11: sparse: expected unsigned char *p
arch/sh/boards/board-sh7785lcr.c:322:11: sparse: got void [noderef] __iomem *
>> arch/sh/boards/board-sh7785lcr.c:328:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got unsigned char *p @@
arch/sh/boards/board-sh7785lcr.c:328:17: sparse: expected void volatile [noderef] __iomem *addr
arch/sh/boards/board-sh7785lcr.c:328:17: sparse: got unsigned char *p
arch/sh/boards/board-sh7785lcr.c: note: in included file (through arch/sh/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
--
drivers/spi/spi-sh-sci.c: note: in included file (through arch/sh/include/asm/io.h, include/linux/scatterlist.h, include/linux/spi/spi.h):
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
--
drivers/spi/spi-nxp-fspi.c:513:25: sparse: sparse: cast from restricted __be32
drivers/spi/spi-nxp-fspi.c: note: in included file (through arch/sh/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
--
drivers/scsi/aacraid/rx.c: note: in included file (through arch/sh/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
--
drivers/scsi/aacraid/nark.c: note: in included file (through arch/sh/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
--
drivers/scsi/aacraid/rkt.c: note: in included file (through arch/sh/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
--
drivers/scsi/aacraid/sa.c: note: in included file (through arch/sh/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
--
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: cast to restricted __le32
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: cast to restricted __le32
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: cast to restricted __le32
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: cast to restricted __le32
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: cast to restricted __le32
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: restricted __le32 degrades to integer
drivers/scsi/aacraid/src.c:146:34: sparse: sparse: cast to restricted __le32
drivers/scsi/aacraid/src.c:507:54: sparse: sparse: restricted __le16 degrades to integer
drivers/scsi/aacraid/src.c:545:57: sparse: sparse: bad assignment (+=) to restricted __le32
drivers/scsi/aacraid/src.c:552:57: sparse: sparse: bad assignment (+=) to restricted __le32
drivers/scsi/aacraid/src.c:560:49: sparse: sparse: bad assignment (+=) to restricted __le32
drivers/scsi/aacraid/src.c:563:55: sparse: sparse: bad assignment (+=) to restricted __le32
drivers/scsi/aacraid/src.c:804:15: sparse: sparse: cast removes address space '__iomem' of expression
drivers/scsi/aacraid/src.c:804:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got char * @@
drivers/scsi/aacraid/src.c:804:15: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/scsi/aacraid/src.c:804:15: sparse: got char *
drivers/scsi/aacraid/src.c:804:15: sparse: sparse: cast removes address space '__iomem' of expression
drivers/scsi/aacraid/src.c:806:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/scsi/aacraid/src.c:806:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *ptr @@ got char * @@
drivers/scsi/aacraid/src.c:806:9: sparse: expected void const volatile [noderef] __iomem *ptr
drivers/scsi/aacraid/src.c:806:9: sparse: got char *
drivers/scsi/aacraid/src.c:806:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/scsi/aacraid/src.c: note: in included file (through arch/sh/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)
>> include/asm-generic/io.h:1089:41: sparse: sparse: cast truncates bits from constant value (384000000506 becomes 506)

vim +18 kernel/iomem.c

5981690ddb8f72 Dan Williams 2018-03-29 14
5981690ddb8f72 Dan Williams 2018-03-29 15 #ifndef arch_memremap_wb
5981690ddb8f72 Dan Williams 2018-03-29 16 static void *arch_memremap_wb(resource_size_t offset, unsigned long size)
5981690ddb8f72 Dan Williams 2018-03-29 17 {
5981690ddb8f72 Dan Williams 2018-03-29 @18 return (__force void *)ioremap_cache(offset, size);
5981690ddb8f72 Dan Williams 2018-03-29 19 }
5981690ddb8f72 Dan Williams 2018-03-29 20 #endif
5981690ddb8f72 Dan Williams 2018-03-29 21

:::::: The code at line 18 was first introduced by commit
:::::: 5981690ddb8f72f9546a2d017a914cf56095fc1f memremap: split devm_memremap_pages() and memremap() infrastructure

:::::: TO: Dan Williams <dan.j.williams@xxxxxxxxx>
:::::: CC: Dan Williams <dan.j.williams@xxxxxxxxx>

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