Re: mm/filemap.c:3307 do_sync_mmap_readahead() warn: assigning (-12) to unsigned variable 'ra->order'
From: Jan Kara
Date: Tue Jan 13 2026 - 07:24:23 EST
On Tue 13-01-26 14:12:28, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: b71e635feefc852405b14620a7fc58c4c80c0f73
> commit: 9f1edf1aedac1b287355f63f768ba4275de72dca mm: readahead: make thp readahead conditional to mmap_miss logic
> config: x86_64-randconfig-161-20260113 (https://download.01.org/0day-ci/archive/20260113/202601131311.g3lyUAks-lkp@xxxxxxxxx/config)
> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
> smatch version: v0.5.0-8985-g2614ff1a
>
> 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>
> | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> | Closes: https://lore.kernel.org/r/202601131311.g3lyUAks-lkp@xxxxxxxxx/
>
> smatch warnings:
> mm/filemap.c:3307 do_sync_mmap_readahead() warn: assigning (-12) to unsigned variable 'ra->order'
...
> 9f1edf1aedac1b2 Roman Gushchin 2025-10-06 3306 ra->async_size = HPAGE_PMD_NR;
> 9f1edf1aedac1b2 Roman Gushchin 2025-10-06 @3307 ra->order = HPAGE_PMD_ORDER;
>
> HPAGE_PMD_SHIFT is zero in this config?
> ra->order is a u16.
What's the config exactly? I suppose CONFIG_TRANSPARENT_HUGEPAGE is
disabled in this case, isn't it? In that case force_thp_readahead will
never be true and thus the branch with the assignment can never be reached
AFAICT...
Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR