]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()
authorDavid Laight <David.Laight@ACULAB.COM>
Fri, 3 Oct 2025 12:15:17 +0000 (12:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 09:56:22 +0000 (11:56 +0200)
commit1519fbc8832b974c118ad300b188ceb9524e2969
treefff6dc61edde9da7ff21146ce31cb9a873d677e4
parent5a5ef438faf127cbf1b7c5ed53eb1df76dffdf12
minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()

[ Upstream commit a5743f32baec4728711bbc01d6ac2b33d4c67040 ]

Use BUILD_BUG_ON_MSG(statically_true(ulo > uhi), ...) for the sanity check
of the bounds in clamp().  Gives better error coverage and one less
expansion of the arguments.

Link: https://lkml.kernel.org/r/34d53778977747f19cce2abb287bb3e6@AcuMS.aculab.com
Signed-off-by: David Laight <david.laight@aculab.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Arnd Bergmann <arnd@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Mateusz Guzik <mjguzik@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Eliav Farber <farbere@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/minmax.h