* kernel/iomem.c:18:32: sparse: sparse: cast truncates bits from constant value (38400000050e becomes 50e)
@ 2024-07-28 7:45 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2024-07-28 7:45 UTC (permalink / raw)
To: Baoquan He
Cc: oe-kbuild-all, linux-kernel, Andrew Morton, Linux Memory Management List
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@intel.com/config)
compiler: sh4-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240728/202407281541.d1dk2Bne-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/202407281541.d1dk2Bne-lkp@intel.com/
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@intel.com>
:::::: CC: Dan Williams <dan.j.williams@intel.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* kernel/iomem.c:18:32: sparse: sparse: cast truncates bits from constant value (38400000050e becomes 50e)
@ 2024-09-13 21:22 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2024-09-13 21:22 UTC (permalink / raw)
To: Baoquan He
Cc: oe-kbuild-all, linux-kernel, Andrew Morton, Linux Memory Management List
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e936e7d4a83b5ff6b7a685722f0ba348383af68c
commit: 0453c9a78015cb2219cda7239d881f4e3137bff8 sh: mm: convert to GENERIC_IOREMAP
date: 1 year, 1 month ago
config: sh-randconfig-r113-20240913 (https://download.01.org/0day-ci/archive/20240914/202409140544.bY7KrkTy-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240914/202409140544.bY7KrkTy-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/202409140544.bY7KrkTy-lkp@intel.com/
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
--
drivers/usb/musb/tusb6010.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)
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
5981690ddb8f72 Dan Williams 2018-03-29 22 #ifndef arch_memremap_can_ram_remap
5981690ddb8f72 Dan Williams 2018-03-29 23 static bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
5981690ddb8f72 Dan Williams 2018-03-29 24 unsigned long flags)
5981690ddb8f72 Dan Williams 2018-03-29 25 {
5981690ddb8f72 Dan Williams 2018-03-29 26 return true;
5981690ddb8f72 Dan Williams 2018-03-29 27 }
5981690ddb8f72 Dan Williams 2018-03-29 28 #endif
5981690ddb8f72 Dan Williams 2018-03-29 29
5981690ddb8f72 Dan Williams 2018-03-29 30 static void *try_ram_remap(resource_size_t offset, size_t size,
5981690ddb8f72 Dan Williams 2018-03-29 31 unsigned long flags)
5981690ddb8f72 Dan Williams 2018-03-29 32 {
5981690ddb8f72 Dan Williams 2018-03-29 33 unsigned long pfn = PHYS_PFN(offset);
5981690ddb8f72 Dan Williams 2018-03-29 34
5981690ddb8f72 Dan Williams 2018-03-29 35 /* In the simple case just return the existing linear address */
5981690ddb8f72 Dan Williams 2018-03-29 36 if (pfn_valid(pfn) && !PageHighMem(pfn_to_page(pfn)) &&
5981690ddb8f72 Dan Williams 2018-03-29 37 arch_memremap_can_ram_remap(offset, size, flags))
5981690ddb8f72 Dan Williams 2018-03-29 38 return __va(offset);
5981690ddb8f72 Dan Williams 2018-03-29 39
5981690ddb8f72 Dan Williams 2018-03-29 40 return NULL; /* fallback to arch_memremap_wb */
5981690ddb8f72 Dan Williams 2018-03-29 41 }
5981690ddb8f72 Dan Williams 2018-03-29 42
5981690ddb8f72 Dan Williams 2018-03-29 43 /**
5981690ddb8f72 Dan Williams 2018-03-29 44 * memremap() - remap an iomem_resource as cacheable memory
5981690ddb8f72 Dan Williams 2018-03-29 45 * @offset: iomem resource start address
5981690ddb8f72 Dan Williams 2018-03-29 46 * @size: size of remap
5981690ddb8f72 Dan Williams 2018-03-29 47 * @flags: any of MEMREMAP_WB, MEMREMAP_WT, MEMREMAP_WC,
5981690ddb8f72 Dan Williams 2018-03-29 48 * MEMREMAP_ENC, MEMREMAP_DEC
5981690ddb8f72 Dan Williams 2018-03-29 49 *
5981690ddb8f72 Dan Williams 2018-03-29 50 * memremap() is "ioremap" for cases where it is known that the resource
5981690ddb8f72 Dan Williams 2018-03-29 51 * being mapped does not have i/o side effects and the __iomem
5981690ddb8f72 Dan Williams 2018-03-29 52 * annotation is not applicable. In the case of multiple flags, the different
5981690ddb8f72 Dan Williams 2018-03-29 53 * mapping types will be attempted in the order listed below until one of
5981690ddb8f72 Dan Williams 2018-03-29 54 * them succeeds.
5981690ddb8f72 Dan Williams 2018-03-29 55 *
5981690ddb8f72 Dan Williams 2018-03-29 56 * MEMREMAP_WB - matches the default mapping for System RAM on
5981690ddb8f72 Dan Williams 2018-03-29 57 * the architecture. This is usually a read-allocate write-back cache.
f6c6010a077341 Wei Yang 2019-03-05 58 * Moreover, if MEMREMAP_WB is specified and the requested remap region is RAM
5981690ddb8f72 Dan Williams 2018-03-29 59 * memremap() will bypass establishing a new mapping and instead return
5981690ddb8f72 Dan Williams 2018-03-29 60 * a pointer into the direct map.
5981690ddb8f72 Dan Williams 2018-03-29 61 *
5981690ddb8f72 Dan Williams 2018-03-29 62 * MEMREMAP_WT - establish a mapping whereby writes either bypass the
5981690ddb8f72 Dan Williams 2018-03-29 63 * cache or are written through to memory and never exist in a
5981690ddb8f72 Dan Williams 2018-03-29 64 * cache-dirty state with respect to program visibility. Attempts to
5981690ddb8f72 Dan Williams 2018-03-29 65 * map System RAM with this mapping type will fail.
5981690ddb8f72 Dan Williams 2018-03-29 66 *
5981690ddb8f72 Dan Williams 2018-03-29 67 * MEMREMAP_WC - establish a writecombine mapping, whereby writes may
5981690ddb8f72 Dan Williams 2018-03-29 68 * be coalesced together (e.g. in the CPU's write buffers), but is otherwise
5981690ddb8f72 Dan Williams 2018-03-29 69 * uncached. Attempts to map System RAM with this mapping type will fail.
5981690ddb8f72 Dan Williams 2018-03-29 70 */
5981690ddb8f72 Dan Williams 2018-03-29 71 void *memremap(resource_size_t offset, size_t size, unsigned long flags)
5981690ddb8f72 Dan Williams 2018-03-29 72 {
5981690ddb8f72 Dan Williams 2018-03-29 73 int is_ram = region_intersects(offset, size,
5981690ddb8f72 Dan Williams 2018-03-29 74 IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE);
5981690ddb8f72 Dan Williams 2018-03-29 75 void *addr = NULL;
5981690ddb8f72 Dan Williams 2018-03-29 76
5981690ddb8f72 Dan Williams 2018-03-29 77 if (!flags)
5981690ddb8f72 Dan Williams 2018-03-29 78 return NULL;
5981690ddb8f72 Dan Williams 2018-03-29 79
5981690ddb8f72 Dan Williams 2018-03-29 80 if (is_ram == REGION_MIXED) {
5981690ddb8f72 Dan Williams 2018-03-29 81 WARN_ONCE(1, "memremap attempted on mixed range %pa size: %#lx\n",
5981690ddb8f72 Dan Williams 2018-03-29 82 &offset, (unsigned long) size);
5981690ddb8f72 Dan Williams 2018-03-29 83 return NULL;
5981690ddb8f72 Dan Williams 2018-03-29 84 }
5981690ddb8f72 Dan Williams 2018-03-29 85
5981690ddb8f72 Dan Williams 2018-03-29 86 /* Try all mapping types requested until one returns non-NULL */
5981690ddb8f72 Dan Williams 2018-03-29 87 if (flags & MEMREMAP_WB) {
5981690ddb8f72 Dan Williams 2018-03-29 88 /*
f6c6010a077341 Wei Yang 2019-03-05 89 * MEMREMAP_WB is special in that it can be satisfied
5981690ddb8f72 Dan Williams 2018-03-29 90 * from the direct map. Some archs depend on the
5981690ddb8f72 Dan Williams 2018-03-29 91 * capability of memremap() to autodetect cases where
5981690ddb8f72 Dan Williams 2018-03-29 92 * the requested range is potentially in System RAM.
5981690ddb8f72 Dan Williams 2018-03-29 93 */
5981690ddb8f72 Dan Williams 2018-03-29 94 if (is_ram == REGION_INTERSECTS)
5981690ddb8f72 Dan Williams 2018-03-29 95 addr = try_ram_remap(offset, size, flags);
5981690ddb8f72 Dan Williams 2018-03-29 96 if (!addr)
5981690ddb8f72 Dan Williams 2018-03-29 97 addr = arch_memremap_wb(offset, size);
5981690ddb8f72 Dan Williams 2018-03-29 98 }
5981690ddb8f72 Dan Williams 2018-03-29 99
5981690ddb8f72 Dan Williams 2018-03-29 100 /*
5981690ddb8f72 Dan Williams 2018-03-29 101 * If we don't have a mapping yet and other request flags are
5981690ddb8f72 Dan Williams 2018-03-29 102 * present then we will be attempting to establish a new virtual
5981690ddb8f72 Dan Williams 2018-03-29 103 * address mapping. Enforce that this mapping is not aliasing
5981690ddb8f72 Dan Williams 2018-03-29 104 * System RAM.
5981690ddb8f72 Dan Williams 2018-03-29 105 */
5981690ddb8f72 Dan Williams 2018-03-29 106 if (!addr && is_ram == REGION_INTERSECTS && flags != MEMREMAP_WB) {
5981690ddb8f72 Dan Williams 2018-03-29 107 WARN_ONCE(1, "memremap attempted on ram %pa size: %#lx\n",
5981690ddb8f72 Dan Williams 2018-03-29 108 &offset, (unsigned long) size);
5981690ddb8f72 Dan Williams 2018-03-29 109 return NULL;
5981690ddb8f72 Dan Williams 2018-03-29 110 }
5981690ddb8f72 Dan Williams 2018-03-29 111
5981690ddb8f72 Dan Williams 2018-03-29 112 if (!addr && (flags & MEMREMAP_WT))
5981690ddb8f72 Dan Williams 2018-03-29 @113 addr = ioremap_wt(offset, size);
5981690ddb8f72 Dan Williams 2018-03-29 114
5981690ddb8f72 Dan Williams 2018-03-29 115 if (!addr && (flags & MEMREMAP_WC))
5981690ddb8f72 Dan Williams 2018-03-29 116 addr = ioremap_wc(offset, size);
5981690ddb8f72 Dan Williams 2018-03-29 117
5981690ddb8f72 Dan Williams 2018-03-29 118 return addr;
5981690ddb8f72 Dan Williams 2018-03-29 119 }
5981690ddb8f72 Dan Williams 2018-03-29 120 EXPORT_SYMBOL(memremap);
5981690ddb8f72 Dan Williams 2018-03-29 121
:::::: 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@intel.com>
:::::: CC: Dan Williams <dan.j.williams@intel.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: kernel/iomem.c:18:32: sparse: sparse: cast truncates bits from constant value (38400000050e becomes 50e)
2024-07-28 14:43 kernel test robot
@ 2024-07-30 3:23 ` Baoquan He
0 siblings, 0 replies; 4+ messages in thread
From: Baoquan He @ 2024-07-30 3:23 UTC (permalink / raw)
To: kernel test robot
Cc: oe-kbuild-all, linux-kernel, Andrew Morton, Linux Memory Management List
On 07/28/24 at 10:43pm, kernel test robot wrote:
> 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/202407282201.lk1cNoMd-lkp@intel.com/config)
> compiler: sh4-linux-gcc (GCC) 14.1.0
> reproduce: (https://download.01.org/0day-ci/archive/20240728/202407282201.lk1cNoMd-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/202407282201.lk1cNoMd-lkp@intel.com/
I every tried to fix this when I got this report one year ago. The thing
is I found there are many places like this. I am not sure if it's worth
doing the type casting to satisfy sparse. And the type casting makes
very long line of code and reduce readibility.
If this is confirmed worth, I can post patch to fix them.
>
> 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/esas2r/esas2r_init.c:908:41: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] length @@ got restricted __le32 [usertype] @@
> drivers/scsi/esas2r/esas2r_init.c:908:41: sparse: expected unsigned int [usertype] length
> drivers/scsi/esas2r/esas2r_init.c:908:41: sparse: got restricted __le32 [usertype]
> drivers/scsi/esas2r/esas2r_init.c:1164:35: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] sgl_page_size @@ got restricted __le32 [usertype] @@
> drivers/scsi/esas2r/esas2r_init.c:1164:35: sparse: expected unsigned int [usertype] sgl_page_size
> drivers/scsi/esas2r/esas2r_init.c:1164:35: sparse: got restricted __le32 [usertype]
> drivers/scsi/esas2r/esas2r_init.c:1166:32: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] epoch_time @@ got restricted __le32 [usertype] @@
> drivers/scsi/esas2r/esas2r_init.c:1166:32: sparse: expected unsigned int [usertype] epoch_time
> drivers/scsi/esas2r/esas2r_init.c:1166:32: sparse: got restricted __le32 [usertype]
> drivers/scsi/esas2r/esas2r_init.c:1178:41: sparse: sparse: cast to restricted __le16
> drivers/scsi/esas2r/esas2r_init.c:1178:41: sparse: sparse: cast to restricted __le16
> drivers/scsi/esas2r/esas2r_init.c:1178:41: sparse: sparse: cast to restricted __le16
> drivers/scsi/esas2r/esas2r_init.c:1178:41: sparse: sparse: cast to restricted __le16
> drivers/scsi/esas2r/esas2r_init.c:1181:38: sparse: sparse: cast to restricted __le16
> drivers/scsi/esas2r/esas2r_init.c:1181:38: sparse: sparse: cast to restricted __le16
> drivers/scsi/esas2r/esas2r_init.c:1181:38: sparse: sparse: cast to restricted __le16
> drivers/scsi/esas2r/esas2r_init.c:1181:38: sparse: sparse: cast to restricted __le16
> drivers/scsi/esas2r/esas2r_init.c:1196:25: sparse: sparse: cast to restricted __be32
> drivers/scsi/esas2r/esas2r_init.c:1207:56: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ctl_len @@ got restricted __le32 [usertype] @@
> drivers/scsi/esas2r/esas2r_init.c:1207:56: sparse: expected unsigned int [usertype] ctl_len
> drivers/scsi/esas2r/esas2r_init.c:1207:56: sparse: got restricted __le32 [usertype]
> drivers/scsi/esas2r/esas2r_init.c:1209:56: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] address @@ got restricted __le64 [usertype] @@
> drivers/scsi/esas2r/esas2r_init.c:1209:56: sparse: expected unsigned long long [usertype] address
> drivers/scsi/esas2r/esas2r_init.c:1209:56: sparse: got restricted __le64 [usertype]
> drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
> drivers/scsi/esas2r/esas2r_init.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/esas2r/esas2r_init.c:286:15: sparse: sparse: memset with byte count of 557736
> drivers/scsi/esas2r/esas2r_init.c: note: in included file:
> drivers/scsi/esas2r/esas2r.h:1260:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] ppsense_buf @@ got restricted __le64 [usertype] @@
> drivers/scsi/esas2r/esas2r.h:1260:17: sparse: expected unsigned long long [usertype] ppsense_buf
> drivers/scsi/esas2r/esas2r.h:1260:17: sparse: got restricted __le64 [usertype]
> drivers/scsi/esas2r/esas2r.h:1260:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] ppsense_buf @@ got restricted __le64 [usertype] @@
> drivers/scsi/esas2r/esas2r.h:1260:17: sparse: expected unsigned long long [usertype] ppsense_buf
> drivers/scsi/esas2r/esas2r.h:1260:17: sparse: got restricted __le64 [usertype]
>
> 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@intel.com>
> :::::: CC: Dan Williams <dan.j.williams@intel.com>
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* kernel/iomem.c:18:32: sparse: sparse: cast truncates bits from constant value (38400000050e becomes 50e)
@ 2024-07-28 14:43 kernel test robot
2024-07-30 3:23 ` Baoquan He
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2024-07-28 14:43 UTC (permalink / raw)
To: Baoquan He
Cc: oe-kbuild-all, linux-kernel, Andrew Morton, Linux Memory Management List
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/202407282201.lk1cNoMd-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20240728/202407282201.lk1cNoMd-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/202407282201.lk1cNoMd-lkp@intel.com/
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/esas2r/esas2r_init.c:908:41: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] length @@ got restricted __le32 [usertype] @@
drivers/scsi/esas2r/esas2r_init.c:908:41: sparse: expected unsigned int [usertype] length
drivers/scsi/esas2r/esas2r_init.c:908:41: sparse: got restricted __le32 [usertype]
drivers/scsi/esas2r/esas2r_init.c:1164:35: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] sgl_page_size @@ got restricted __le32 [usertype] @@
drivers/scsi/esas2r/esas2r_init.c:1164:35: sparse: expected unsigned int [usertype] sgl_page_size
drivers/scsi/esas2r/esas2r_init.c:1164:35: sparse: got restricted __le32 [usertype]
drivers/scsi/esas2r/esas2r_init.c:1166:32: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] epoch_time @@ got restricted __le32 [usertype] @@
drivers/scsi/esas2r/esas2r_init.c:1166:32: sparse: expected unsigned int [usertype] epoch_time
drivers/scsi/esas2r/esas2r_init.c:1166:32: sparse: got restricted __le32 [usertype]
drivers/scsi/esas2r/esas2r_init.c:1178:41: sparse: sparse: cast to restricted __le16
drivers/scsi/esas2r/esas2r_init.c:1178:41: sparse: sparse: cast to restricted __le16
drivers/scsi/esas2r/esas2r_init.c:1178:41: sparse: sparse: cast to restricted __le16
drivers/scsi/esas2r/esas2r_init.c:1178:41: sparse: sparse: cast to restricted __le16
drivers/scsi/esas2r/esas2r_init.c:1181:38: sparse: sparse: cast to restricted __le16
drivers/scsi/esas2r/esas2r_init.c:1181:38: sparse: sparse: cast to restricted __le16
drivers/scsi/esas2r/esas2r_init.c:1181:38: sparse: sparse: cast to restricted __le16
drivers/scsi/esas2r/esas2r_init.c:1181:38: sparse: sparse: cast to restricted __le16
drivers/scsi/esas2r/esas2r_init.c:1196:25: sparse: sparse: cast to restricted __be32
drivers/scsi/esas2r/esas2r_init.c:1207:56: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ctl_len @@ got restricted __le32 [usertype] @@
drivers/scsi/esas2r/esas2r_init.c:1207:56: sparse: expected unsigned int [usertype] ctl_len
drivers/scsi/esas2r/esas2r_init.c:1207:56: sparse: got restricted __le32 [usertype]
drivers/scsi/esas2r/esas2r_init.c:1209:56: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] address @@ got restricted __le64 [usertype] @@
drivers/scsi/esas2r/esas2r_init.c:1209:56: sparse: expected unsigned long long [usertype] address
drivers/scsi/esas2r/esas2r_init.c:1209:56: sparse: got restricted __le64 [usertype]
drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1223:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.c:1225:41: sparse: sparse: cast to restricted __le32
drivers/scsi/esas2r/esas2r_init.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/esas2r/esas2r_init.c:286:15: sparse: sparse: memset with byte count of 557736
drivers/scsi/esas2r/esas2r_init.c: note: in included file:
drivers/scsi/esas2r/esas2r.h:1260:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] ppsense_buf @@ got restricted __le64 [usertype] @@
drivers/scsi/esas2r/esas2r.h:1260:17: sparse: expected unsigned long long [usertype] ppsense_buf
drivers/scsi/esas2r/esas2r.h:1260:17: sparse: got restricted __le64 [usertype]
drivers/scsi/esas2r/esas2r.h:1260:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] ppsense_buf @@ got restricted __le64 [usertype] @@
drivers/scsi/esas2r/esas2r.h:1260:17: sparse: expected unsigned long long [usertype] ppsense_buf
drivers/scsi/esas2r/esas2r.h:1260:17: sparse: got restricted __le64 [usertype]
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@intel.com>
:::::: CC: Dan Williams <dan.j.williams@intel.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-13 21:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-28 7:45 kernel/iomem.c:18:32: sparse: sparse: cast truncates bits from constant value (38400000050e becomes 50e) kernel test robot
2024-07-28 14:43 kernel test robot
2024-07-30 3:23 ` Baoquan He
2024-09-13 21:22 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