include/linux/compiler_types.h:630:45: error: call to '__compiletime_assert_612' declared with attribute error: min(((pos + len - 1) >> 12) - (pos >> 12) + 1, max_pages) signedness error
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 563c8dd425b59e44470e28519107b1efc99f4c7b commit: 0f5bb0cfb0b40a31d2fe146ecbef5727690fa547 [1617/1848] fs: use min() or umin() instead of min_t() config: i386-randconfig-2006-20250825 (https://download.01.org/0day-ci/archive/20251216/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251216/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from <command-line>:
In function 'fuse_wr_pages',
inlined from 'fuse_perform_write' at fs/fuse/file.c:1347:27:
>> include/linux/compiler_types.h:630:45: error: call to '__compiletime_assert_612' declared with attribute error: min(((pos + len - 1) >> 12) - (pos >> 12) + 1, max_pages) signedness error
630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
include/linux/compiler_types.h:611:25: note: in definition of macro '__compiletime_assert'
611 | prefix ## suffix(); \
| ^~~~~~
include/linux/compiler_types.h:630:9: note: in expansion of macro '_compiletime_assert'
630 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
| ^~~~~~~~~~~~~~~~~~
include/linux/minmax.h:93:9: note: in expansion of macro 'BUILD_BUG_ON_MSG'
93 | BUILD_BUG_ON_MSG(!__types_ok(ux, uy), \
| ^~~~~~~~~~~~~~~~
include/linux/minmax.h:98:9: note: in expansion of macro '__careful_cmp_once'
98 | __careful_cmp_once(op, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_))
| ^~~~~~~~~~~~~~~~~~
include/linux/minmax.h:105:25: note: in expansion of macro '__careful_cmp'
105 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
fs/fuse/file.c:1326:16: note: in expansion of macro 'min'
1326 | return min(((pos + len - 1) >> PAGE_SHIFT) - (pos >> PAGE_SHIFT) + 1,
| ^~~vim +/__compiletime_assert_612 +630 include/linux/compiler_types.h
eb5c2d4b45e3d2 Will Deacon 2020-07-21 616 eb5c2d4b45e3d2 Will Deacon 2020-07-21 617 #define _compiletime_assert(condition, msg, prefix, suffix) \ eb5c2d4b45e3d2 Will Deacon 2020-07-21 618 __compiletime_assert(condition, msg, prefix, suffix) eb5c2d4b45e3d2 Will Deacon 2020-07-21 619 eb5c2d4b45e3d2 Will Deacon 2020-07-21 620 /** eb5c2d4b45e3d2 Will Deacon 2020-07-21 621 * compiletime_assert - break build and emit msg if condition is false eb5c2d4b45e3d2 Will Deacon 2020-07-21 622 * @condition: a compile-time constant condition to check eb5c2d4b45e3d2 Will Deacon 2020-07-21 623 * @msg: a message to emit if condition is false eb5c2d4b45e3d2 Will Deacon 2020-07-21 624 * eb5c2d4b45e3d2 Will Deacon 2020-07-21 625 * In tradition of POSIX assert, this macro will break the build if the eb5c2d4b45e3d2 Will Deacon 2020-07-21 626 * supplied condition is *false*, emitting the supplied error message if the eb5c2d4b45e3d2 Will Deacon 2020-07-21 627 * compiler has support to do so. eb5c2d4b45e3d2 Will Deacon 2020-07-21 628 */ eb5c2d4b45e3d2 Will Deacon 2020-07-21 629 #define compiletime_assert(condition, msg) \
eb5c2d4b45e3d2 Will Deacon 2020-07-21 @630 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)eb5c2d4b45e3d2 Will Deacon 2020-07-21 631
:::::: The code at line 630 was first introduced by commit
:::::: eb5c2d4b45e3d2d5d052ea6b8f1463976b1020d5 compiler.h: Move compiletime_assert() macros into compiler_types.h
:::::: TO: Will Deacon <[email protected]>
:::::: CC: Will Deacon <[email protected]>
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Quoted 12 lines · On Tue, 16 Dec 2025 09:05:42 +0100 kernel test robot <[email protected]> wrote:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 563c8dd425b59e44470e28519107b1efc99f4c7b commit: 0f5bb0cfb0b40a31d2fe146ecbef5727690fa547 [1617/1848] fs: use min() or umin() instead of min_t() config: i386-randconfig-2006-20250825 (https://download.01.org/0day-ci/archive/20251216/[email protected]/config) compiler: gcc-14 (Debian 14.2.0-19) 14.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251216/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Quoted 6 lines
All errors (new ones prefixed by >>):
In file included from <command-line>:
In function 'fuse_wr_pages',inlined from 'fuse_perform_write' at fs/fuse/file.c:1347:27:Quoted 1 line
Quoted 1 line
include/linux/compiler_types.h:630:45: error: call to '__compiletime_assert_612' declared with attribute error:min(((pos + len - 1) >> 12) - (pos >> 12) + 1, max_pages)signedness error
...
The definitions are:
loff_t pos - 64bit signed.size_t len - unsigned long, 32bit for this i386 build. unsigned int max_pages - 32 bit unsigned.
On a 64bit build 'len' is 64bits unsigned which promotes the LHS to
unsigned and min() is happy.
On a 32bit build this doesn't happen, the LHS remains signed and
min() is unhappy.
I'm not sure why file offsets are signed (apart from relative lseek()), causes signedness issues in a few places.
In any case there are a few ways to fix this.
Clearly a cast could be used somewhere, the most subtle would be changing the prototype to 'u64 len'.
Perhaps better is rewriting the conditional as:
min(((len + (pos & (PAGE_SIZE - 1)) - 1) >> PAGE_SHIFT) + 1, max_pages);
Although the LHS is still signed 64bit, the compiler knows it can't be negative.
This still contains a lot of 64bit maths, adding a cast:
min(((len + (size_t)(pos & (PAGE_SIZE - 1)) - 1) >> PAGE_SHIFT) + 1,
makes it 32bit and the generated code much, much better.
In theory the expression can overflow (fixable by masking off the high bit of 'len' (eg (len << 1 >> 1)), but normal IO are limited to MAX_RW_COUNT (INT_MAX & PAGE_MASK) even on 64bit.
I'm not sure io_uring enforces that limit (it should, a lot of drivers are broken if the requested size exceeds 4G).
David