RE: [PATCH v2 00/27 5.10.y] Backport minmax.h updates from v6.17-rc7

Farber, Eliav
2025-10-18T20:07:56Z

> On Fri, Oct 17, 2025 at 09:04:52AM +0000, Eliav Farber wrote:
> > This series backports 27 patches to update minmax.h in the 5.10.y
> > branch, aligning it with v6.17-rc7.
> >
> > The ultimate goal is to synchronize all long-term branches so that they
> > include the full set of minmax.h changes.
> >
> > - 6.12.y has already been backported; the changes are included in
> > v6.12.49.
> > - 6.6.y has already been backported; the changes are included in
> > v6.6.109.
> > - 6.1.y has already been backported; the changes are currently in the
> > 6.1-stable tree.
> > - 5.15.y has already been backported; the changes are currently in the
> > 5.15-stable tree.
>
> With this series applied, on an arm64 server, building 'allmodconfig', I
> get the following build error.
>
> Oddly I don't see it on my x86 server, perhaps due to different compiler
> versions?
>
> Any ideas?

This mainline commit is missing:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/net/wireless/ralink/rt2x00/rt2800lib.c?h=v6.18-rc1&id=66063033f77e10b985258126a97573f84bb8d3b4

This fix already exists in 5.15.y:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/net/wireless/ralink/rt2x00/rt2800lib.c?h=v5.15.194&id=2d3cef3d7a5df260a14a6679c4aca0c97e570ee5
…but is missing in 5.10.y.

I now backported it to 5.10.y here:
https://lore.kernel.org/stable/20251018195945.18825-1-farbere@amazon.com/T/#u

Regards, Eliav

> In function ‘rt2800_txpower_to_dev’,
> inlined from ‘rt2800_config_channel’ at ../drivers/net/wireless/ralink/rt2x00/rt2800lib.c:4022:25:
>./../include/linux/compiler_types.h:309:45: error: call to ‘__compiletime_assert_1168’ declared with attribute error: clamp() low limit -7 greater than high limit 15
> 309 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> | ^
>./../include/linux/compiler_types.h:290:25: note: in definition of macro ‘__compiletime_assert’
> 290 | prefix ## suffix(); \
> | ^~~~~~
>./../include/linux/compiler_types.h:309:9: note: in expansion of macro ‘_compiletime_assert’
> 309 | _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:188:9: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
> 188 | BUILD_BUG_ON_MSG(statically_true(ulo > uhi), \
> | ^~~~~~~~~~~~~~~~
>../include/linux/minmax.h:195:9: note: in expansion of macro ‘__clamp_once’
> 195 | __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), __UNIQUE_ID(h_))
> | ^~~~~~~~~~~~
>../include/linux/minmax.h:218:36: note: in expansion of macro ‘__careful_clamp’
> 218 | #define clamp_t(type, val, lo, hi) __careful_clamp(type, val, lo, hi)
> | ^~~~~~~~~~~~~~~
>../drivers/net/wireless/ralink/rt2x00/rt2800lib.c:3980:24: note: in expansion of macro ‘clamp_t’
> 3980 | return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
> | ^~~~~~~
> In function ‘rt2800_txpower_to_dev’,
> inlined from ‘rt2800_config_channel’ at ../drivers/net/wireless/ralink/rt2x00/rt2800lib.c:4024:25:
>./../include/linux/compiler_types.h:309:45: error: call to ‘__compiletime_assert_1168’ declared with attribute error: clamp() low limit -7 greater than high limit 15
> 309 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> | ^
>./../include/linux/compiler_types.h:290:25: note: in definition of macro ‘__compiletime_assert’
> 290 | prefix ## suffix(); \
> | ^~~~~~
>./../include/linux/compiler_types.h:309:9: note: in expansion of macro ‘_compiletime_assert’
> 309 | _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:188:9: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
> 188 | BUILD_BUG_ON_MSG(statically_true(ulo > uhi), \
> | ^~~~~~~~~~~~~~~~
>../include/linux/minmax.h:195:9: note: in expansion of macro ‘__clamp_once’
> 195 | __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), __UNIQUE_ID(h_))
> | ^~~~~~~~~~~~
>../include/linux/minmax.h:218:36: note: in expansion of macro ‘__careful_clamp’
> 218 | #define clamp_t(type, val, lo, hi) __careful_clamp(type, val, lo, hi)
> | ^~~~~~~~~~~~~~~
>../drivers/net/wireless/ralink/rt2x00/rt2800lib.c:3980:24: note: in expansion of macro ‘clamp_t’
> 3980 | return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
> | ^~~~~~~
> In function ‘rt2800_txpower_to_dev’,
> inlined from ‘rt2800_config_channel’ at ../drivers/net/wireless/ralink/rt2x00/rt2800lib.c:4028:4:
>./../include/linux/compiler_types.h:309:45: error: call to ‘__compiletime_assert_1168’ declared with attribute error: clamp() low limit -7 greater than high limit 15
> 309 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
> | ^
>./../include/linux/compiler_types.h:290:25: note: in definition of macro ‘__compiletime_assert’
> 290 | prefix ## suffix(); \
> | ^~~~~~
>./../include/linux/compiler_types.h:309:9: note: in expansion of macro ‘_compiletime_assert’
> 309 | _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:188:9: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
> 188 | BUILD_BUG_ON_MSG(statically_true(ulo > uhi), \
> | ^~~~~~~~~~~~~~~~
>../include/linux/minmax.h:195:9: note: in expansion of macro ‘__clamp_once’
> 195 | __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), __UNIQUE_ID(h_))
> | ^~~~~~~~~~~~
>../include/linux/minmax.h:218:36: note: in expansion of macro ‘__careful_clamp’
> 218 | #define clamp_t(type, val, lo, hi) __careful_clamp(type, val, lo, hi)
> | ^~~~~~~~~~~~~~~
>../drivers/net/wireless/ralink/rt2x00/rt2800lib.c:3980:24: note: in expansion of macro ‘clamp_t’
> 3980 | return clamp_t(char, txpower, MIN_A_TXPOWER, MAX_A_TXPOWER);
> | ^~~~~~~
> make[6]: *** [../scripts/Makefile.build:286: drivers/net/wireless/ralink/rt2x00/rt2800lib.o] Error 1
> make[5]: *** [../scripts/Makefile.build:503: drivers/net/wireless/ralink/rt2x00] Error 2
> make[4]: *** [../scripts/Makefile.build:503: drivers/net/wireless/ralink] Error 2
> make[4]: *** Waiting for unfinished jobs....