[BUG] clamp() low limit 0 greater than high limit points[1] - 1

From: Paul E. McKenney

Date: Wed Oct 14 2026 - 16:14:17 EST


Hello!

Recent -next trees have failed allmodconfig builds with the following
build error:

drivers/hwmon/minisforum-um780xtx.c: In function ‘um780xtx_sys_point_temp_store’:
HDRTEST usr/include/linux/hash_info.h
././include/linux/compiler_types.h:702:45: error: call to ‘__compiletime_assert_727’ declared with attribute error: clamp() low limit 0 greater than high limit points[1] - 1
702 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^
././include/linux/compiler_types.h:683:25: note: in definition of macro ‘__compiletime_assert’
683 | prefix ## suffix(); \
| ^~~~~~
././include/linux/compiler_types.h:702:9: note: in expansion of macro ‘_compiletime_assert’
702 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
| ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:40:37: note: in expansion of macro ‘compiletime_assert’
40 | #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:231:32: note: in expansion of macro ‘__careful_clamp’
231 | #define clamp_val(val, lo, hi) __careful_clamp(typeof(val), val, lo, hi)
| ^~~~~~~~~~~~~~~
drivers/hwmon/minisforum-um780xtx.c:203:25: note: in expansion of macro ‘clamp_val’
203 | value = clamp_val(value, 0, points[1] - 1);
| ^~~~~~~~~

I must confess to being unsure what fix would be appropriate when
points[1] is zero or negative.

Help?

Thanx, Paul