Re: [PATCH] Fix the data type inconsistency issue of min (tier, MAX_CR_TIERS-1) in read_ctrl_pos

From: David Hildenbrand
Date: Fri Aug 08 2025 - 05:33:03 EST


On 08.08.25 11:26, fffsqian wrote:
Hi David,


Thanks a lot for your feedback!


Regarding the question of why only I encountered this error: it’s because my compilation environment has CONFIG_WERROR enabled (treating warnings as errors). The original code triggers a static assertion warning (due to the signed/unsigned mismatch in min(tier, 4U - 1)), which would normally be a non-fatal warning. However, with CONFIG_WERROR, this gets elevated to a compile error, making it visible in my builds.

Does it?

$ make mm/vmscan.o
...
CC mm/vmscan.o
$ gcc --version
gcc (GCC) 15.1.1 20250521 (Red Hat 15.1.1-2)

What am I missing?



The error message is as follows:

from mm/vmscan.c:15:

mm/vmscan.c: In function ‘read_ctrl_pos’:

./include/linux/build_bug.h:78:41: error: static assertion failed: "min(tier, 4U - 1) signedness error, fix types or consider umin() before min_t()"


I really appreciate your suggestions on the patch format issues—I’ve addressed those as well, including adding fix information and streamlining patch descriptions, etc.


V2 of the patch will be sent shortly.

Please wait with v2 until the discussion is over. Also, flag your patches as v2 like [PATCH v2] etc.

--
Cheers,

David / dhildenb