kernel/scs.c:86:21: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Tue Nov 21 2023 - 03:47:13 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 98b1cc82c4affc16f5598d4fa14b1858671b2263
commit: d1584d791a297aa8ed93503382a682a6ecfc4218 riscv: Implement Shadow Call Stack
date: 3 weeks ago
config: riscv-randconfig-r132-20231121 (https://download.01.org/0day-ci/archive/20231121/202311211604.nMVAanJQ-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a)
reproduce: (https://download.01.org/0day-ci/archive/20231121/202311211604.nMVAanJQ-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/202311211604.nMVAanJQ-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
WARNING: invalid argument to '-march': '_zihintpause'
>> kernel/scs.c:86:21: sparse: sparse: Using plain integer as NULL pointer
>> kernel/scs.c:86:21: sparse: sparse: Using plain integer as NULL pointer
>> kernel/scs.c:86:21: sparse: sparse: Using plain integer as NULL pointer
>> kernel/scs.c:86:21: sparse: sparse: Using plain integer as NULL pointer

vim +86 kernel/scs.c

d08b9f0ca6605e Sami Tolvanen 2020-04-27 72
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 73 void scs_free(void *s)
d08b9f0ca6605e Sami Tolvanen 2020-04-27 74 {
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 75 int i;
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 76
bee348fab099b0 Will Deacon 2020-05-15 77 __scs_account(s, -1);
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 78
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 79 /*
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 80 * We cannot sleep as this can be called in interrupt context,
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 81 * so use this_cpu_cmpxchg to update the cache, and vfree_atomic
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 82 * to free the stack.
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 83 */
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 84
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 85 for (i = 0; i < NR_CACHED_SCS; i++)
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 @86 if (this_cpu_cmpxchg(scs_cache[i], 0, s) == NULL)
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 87 return;
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 88
f6e39794f4b6da Andrey Konovalov 2022-03-24 89 kasan_unpoison_vmalloc(s, SCS_SIZE, KASAN_VMALLOC_PROT_NORMAL);
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 90 vfree_atomic(s);
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 91 }
a2abe7cbd8fe2d Sami Tolvanen 2020-11-30 92

:::::: The code at line 86 was first introduced by commit
:::::: a2abe7cbd8fe2db5ff386c968e2273d9dc6c468d scs: switch to vmapped shadow stacks

:::::: TO: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
:::::: CC: Will Deacon <will@xxxxxxxxxx>

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