fs/pstore/ram_core.c:532:36: sparse: sparse: incorrect type in argument 1 (different address spaces)
From: kernel test robot
Date: Wed Dec 13 2023 - 09:14:39 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 88035e5694a86a7167d490bb95e9df97a9bb162b
commit: a811c05c16b53ff89e9cfc029ec77a0aae846881 nios2: use generic early_init_dt_add_memory_arch
date: 5 years ago
config: nios2-randconfig-r113-20231116 (https://download.01.org/0day-ci/archive/20231213/202312132232.faZpeGsh-lkp@xxxxxxxxx/config)
compiler: nios2-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231213/202312132232.faZpeGsh-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/202312132232.faZpeGsh-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
fs/pstore/ram_core.c:277:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got unsigned char * @@
fs/pstore/ram_core.c:277:34: sparse: expected void volatile [noderef] __iomem *addr
fs/pstore/ram_core.c:277:34: sparse: got unsigned char *
fs/pstore/ram_core.c:310:50: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned char * @@
fs/pstore/ram_core.c:310:50: sparse: expected void const volatile [noderef] __iomem *addr
fs/pstore/ram_core.c:310:50: sparse: got unsigned char *
fs/pstore/ram_core.c:311:65: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned char * @@
fs/pstore/ram_core.c:311:65: sparse: expected void const volatile [noderef] __iomem *addr
fs/pstore/ram_core.c:311:65: sparse: got unsigned char *
fs/pstore/ram_core.c:452:20: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *va @@ got void [noderef] __iomem * @@
fs/pstore/ram_core.c:452:20: sparse: expected void *va
fs/pstore/ram_core.c:452:20: sparse: got void [noderef] __iomem *
fs/pstore/ram_core.c:454:20: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *va @@ got void [noderef] __iomem * @@
fs/pstore/ram_core.c:454:20: sparse: expected void *va
fs/pstore/ram_core.c:454:20: sparse: got void [noderef] __iomem *
>> fs/pstore/ram_core.c:532:36: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got void *vaddr @@
fs/pstore/ram_core.c:532:36: sparse: expected void [noderef] __iomem *addr
fs/pstore/ram_core.c:532:36: sparse: got void *vaddr
fs/pstore/ram_core.c: note: in included file (through include/linux/irqflags.h, include/asm-generic/bitops.h, arch/nios2/include/generated/asm/bitops.h, ...):
arch/nios2/include/asm/irqflags.h:25:16: sparse: sparse: undefined identifier '__builtin_rdctl'
arch/nios2/include/asm/irqflags.h:34:9: sparse: sparse: undefined identifier '__builtin_wrctl'
fs/pstore/ram_core.c: In function 'persistent_ram_save_old':
fs/pstore/ram_core.c:310:37: warning: array subscript <unknown> is outside array bounds of 'uint8_t[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
310 | memcpy_fromio(prz->old_log, &buffer->data[start], size - start);
| ^~~~~~~~~~~~~~~~~~~~
fs/pstore/ram_core.c:36:21: note: while referencing 'data'
36 | uint8_t data[0];
| ^~~~
fs/pstore/ram_core.c:311:52: warning: array subscript 0 is outside array bounds of 'uint8_t[0]' {aka 'unsigned char[]'} [-Warray-bounds=]
311 | memcpy_fromio(prz->old_log + size - start, &buffer->data[0], start);
| ^~~~~~~~~~~~~~~~
fs/pstore/ram_core.c:36:21: note: while referencing 'data'
36 | uint8_t data[0];
| ^~~~
vim +532 fs/pstore/ram_core.c
bb4206f2042d95 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 521
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 522 void persistent_ram_free(struct persistent_ram_zone *prz)
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 523 {
beeb94321a7a6d fs/pstore/ram_core.c Anton Vorontsov 2012-06-18 524 if (!prz)
beeb94321a7a6d fs/pstore/ram_core.c Anton Vorontsov 2012-06-18 525 return;
beeb94321a7a6d fs/pstore/ram_core.c Anton Vorontsov 2012-06-18 526
beeb94321a7a6d fs/pstore/ram_core.c Anton Vorontsov 2012-06-18 527 if (prz->vaddr) {
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 528 if (pfn_valid(prz->paddr >> PAGE_SHIFT)) {
831b624df1b420 fs/pstore/ram_core.c Bin Yang 2018-09-12 529 /* We must vunmap() at page-granularity. */
831b624df1b420 fs/pstore/ram_core.c Bin Yang 2018-09-12 530 vunmap(prz->vaddr - offset_in_page(prz->paddr));
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 531 } else {
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 @532 iounmap(prz->vaddr);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 533 release_mem_region(prz->paddr, prz->size);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 534 }
beeb94321a7a6d fs/pstore/ram_core.c Anton Vorontsov 2012-06-18 535 prz->vaddr = NULL;
beeb94321a7a6d fs/pstore/ram_core.c Anton Vorontsov 2012-06-18 536 }
f2531f1976d98a fs/pstore/ram_core.c Kees Cook 2018-03-07 537 if (prz->rs_decoder) {
f2531f1976d98a fs/pstore/ram_core.c Kees Cook 2018-03-07 538 free_rs(prz->rs_decoder);
f2531f1976d98a fs/pstore/ram_core.c Kees Cook 2018-03-07 539 prz->rs_decoder = NULL;
f2531f1976d98a fs/pstore/ram_core.c Kees Cook 2018-03-07 540 }
f2531f1976d98a fs/pstore/ram_core.c Kees Cook 2018-03-07 541 kfree(prz->ecc_info.par);
f2531f1976d98a fs/pstore/ram_core.c Kees Cook 2018-03-07 542 prz->ecc_info.par = NULL;
f2531f1976d98a fs/pstore/ram_core.c Kees Cook 2018-03-07 543
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 544 persistent_ram_free_old(prz);
1227daa43bce13 fs/pstore/ram_core.c Kees Cook 2018-10-17 545 kfree(prz->label);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 546 kfree(prz);
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 547 }
d3b487695120b5 drivers/staging/android/persistent_ram.c Anton Vorontsov 2012-05-11 548
:::::: The code at line 532 was first introduced by commit
:::::: d3b487695120b5342067244253697eabb121436d staging: android: persistent_ram: Introduce persistent_ram_free()
:::::: TO: Anton Vorontsov <anton.vorontsov@xxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki