Re: mm/filemap.c:4249:1: sparse: sparse: Using plain integer as NULL pointer

From: Nhat Pham
Date: Tue Nov 07 2023 - 17:07:10 EST


On Tue, Nov 7, 2023 at 8:30 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: be3ca57cfb777ad820c6659d52e60bbdd36bf5ff
> commit: cf264e1329fb0307e044f7675849f9f38b44c11a cachestat: implement cachestat syscall
> date: 5 months ago
> config: s390-randconfig-r123-20231107 (https://download.01.org/0day-ci/archive/20231108/202311080014.GABRIG2T-lkp@xxxxxxxxx/config)
> compiler: s390-linux-gcc (GCC) 13.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20231108/202311080014.GABRIG2T-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/202311080014.GABRIG2T-lkp@xxxxxxxxx/
>
> sparse warnings: (new ones prefixed by >>)
> mm/filemap.c:1416:17: sparse: sparse: context imbalance in 'migration_entry_wait_on_locked' - unexpected unlock
> >> mm/filemap.c:4249:1: sparse: sparse: Using plain integer as NULL pointer
> >> mm/filemap.c:4249:1: sparse: sparse: Using plain integer as NULL pointer
> >> mm/filemap.c:4249:1: sparse: sparse: Using plain integer as NULL pointer
> >> mm/filemap.c:4249:1: sparse: sparse: Using plain integer as NULL pointer
>
> vim +4249 mm/filemap.c
>
> 4214
> 4215 /*
> 4216 * The cachestat(2) system call.
> 4217 *
> 4218 * cachestat() returns the page cache statistics of a file in the
> 4219 * bytes range specified by `off` and `len`: number of cached pages,
> 4220 * number of dirty pages, number of pages marked for writeback,
> 4221 * number of evicted pages, and number of recently evicted pages.
> 4222 *
> 4223 * An evicted page is a page that is previously in the page cache
> 4224 * but has been evicted since. A page is recently evicted if its last
> 4225 * eviction was recent enough that its reentry to the cache would
> 4226 * indicate that it is actively being used by the system, and that
> 4227 * there is memory pressure on the system.
> 4228 *
> 4229 * `off` and `len` must be non-negative integers. If `len` > 0,
> 4230 * the queried range is [`off`, `off` + `len`]. If `len` == 0,
> 4231 * we will query in the range from `off` to the end of the file.
> 4232 *
> 4233 * The `flags` argument is unused for now, but is included for future
> 4234 * extensibility. User should pass 0 (i.e no flag specified).
> 4235 *
> 4236 * Currently, hugetlbfs is not supported.
> 4237 *
> 4238 * Because the status of a page can change after cachestat() checks it
> 4239 * but before it returns to the application, the returned values may
> 4240 * contain stale information.
> 4241 *
> 4242 * return values:
> 4243 * zero - success
> 4244 * -EFAULT - cstat or cstat_range points to an illegal address
> 4245 * -EINVAL - invalid flags
> 4246 * -EBADF - invalid file descriptor
> 4247 * -EOPNOTSUPP - file descriptor is of a hugetlbfs file
> 4248 */
> > 4249 SYSCALL_DEFINE4(cachestat, unsigned int, fd,
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki

This is a known false positive with s390. See this thread:
https://lore.kernel.org/linux-mm/202305070840.X0G3ofjl-lkp@xxxxxxxxx/