From: kernel test robot <lkp@intel.com>
To: David Laight <David.Laight@aculab.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: oe-kbuild-all@lists.linux.dev,
LKML <linux-kernel@vger.kernel.org>,
'Arnd Bergmann' <arnd@kernel.org>, 'Jens Axboe' <axboe@kernel.dk>,
'Matthew Wilcox' <willy@infradead.org>,
'Christoph Hellwig' <hch@infradead.org>,
'Andrew Morton' <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
'Andy Shevchenko' <andriy.shevchenko@linux.intel.com>,
'Dan Carpenter' <dan.carpenter@linaro.org>,
"'Jason A . Donenfeld'" <Jason@zx2c4.com>,
"'pedro.falcato@gmail.com'" <pedro.falcato@gmail.com>,
'Mateusz Guzik' <mjguzik@gmail.com>,
'Lorenzo Stoakes' <lorenzo.stoakes@oracle.com>
Subject: Re: [PATCH next 6/7] minmax.h: Simplify the variants of clamp()
Date: Sat, 23 Nov 2024 04:20:02 +0800 [thread overview]
Message-ID: <202411230458.dhZwh3TT-lkp@intel.com> (raw)
In-Reply-To: <8f69f4deac014f558bab186444bac2e8@AcuMS.aculab.com>
Hi David,
kernel test robot noticed the following build warnings:
[auto build test WARNING on next-20241121]
url: https://github.com/intel-lab-lkp/linux/commits/David-Laight/minmax-h-Add-whitespace-around-operators-and-after-commas/20241121-152617
base: next-20241121
patch link: https://lore.kernel.org/r/8f69f4deac014f558bab186444bac2e8%40AcuMS.aculab.com
patch subject: [PATCH next 6/7] minmax.h: Simplify the variants of clamp()
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20241123/202411230458.dhZwh3TT-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241123/202411230458.dhZwh3TT-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411230458.dhZwh3TT-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:28,
from include/linux/cpumask.h:11,
from arch/loongarch/include/asm/processor.h:9,
from arch/loongarch/include/asm/thread_info.h:15,
from include/linux/thread_info.h:60,
from include/asm-generic/current.h:6,
from ./arch/loongarch/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from include/linux/delay.h:13,
from drivers/iio/magnetometer/yamaha-yas530.c:27:
drivers/iio/magnetometer/yamaha-yas530.c: In function 'yas537_measure':
>> include/linux/minmax.h:188:20: warning: overflow in conversion from 'long unsigned int' to 's32' {aka 'int'} changes value from '18446744073709543424' to '-8192' [-Woverflow]
188 | type ulo = (lo); \
| ^
include/linux/minmax.h:197:9: note: in expansion of macro '__clamp_once'
197 | __clamp_once(type, val, lo, hi, __UNIQUE_ID(v_), __UNIQUE_ID(l_), __UNIQUE_ID(h_))
| ^~~~~~~~~~~~
include/linux/minmax.h:233:32: note: in expansion of macro '__careful_clamp'
233 | #define clamp_val(val, lo, hi) __careful_clamp(typeof(val), val, lo, hi)
| ^~~~~~~~~~~~~~~
drivers/iio/magnetometer/yamaha-yas530.c:414:25: note: in expansion of macro 'clamp_val'
414 | clamp_val(h[i], -BIT(13), BIT(13) - 1);
| ^~~~~~~~~
vim +188 include/linux/minmax.h
172
173 /**
174 * min_not_zero - return the minimum that is _not_ zero, unless both are zero
175 * @x: value1
176 * @y: value2
177 */
178 #define min_not_zero(x, y) ({ \
179 typeof(x) __x = (x); \
180 typeof(y) __y = (y); \
181 __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); })
182
183 #define __clamp(val, lo, hi) \
184 ((val) >= (hi) ? (hi) : ((val) <= (lo) ? (lo) : (val)))
185
186 #define __clamp_once(type, val, lo, hi, uval, ulo, uhi) ({ \
187 type uval = (val); \
> 188 type ulo = (lo); \
189 type uhi = (hi); \
190 BUILD_BUG_ON_MSG(statically_true(ulo > uhi), \
191 "clamp() low limit " #lo " greater than high limit " #hi); \
192 BUILD_BUG_ON_MSG(!__types_ok3(uval, ulo, uhi), \
193 "clamp("#val", "#lo", "#hi") signedness error"); \
194 __clamp(uval, ulo, uhi); })
195
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2024-11-22 20:20 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 19:09 [PATCH next 0/7] minmax.h: Cleanups and minor optimisations David Laight
2024-11-18 19:11 ` [PATCH next 1/7] minmax.h: Add whitespace around operators and after commas David Laight
2024-11-18 19:12 ` [PATCH next 2/7] minmax.h: Update some comments David Laight
2024-11-18 19:12 ` [PATCH next 3/7] minmax.h: Reduce the #define expansion of min(), max() and clamp() David Laight
2024-11-18 19:13 ` [PATCH next 4/7] minmax.h: Use BUILD_BUG_ON_MSG() for the lo < hi test in clamp() David Laight
2025-01-18 16:13 ` Buiild error in i915/xe (was: [PATCH next 4/7] minmax.h: Use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()) Guenter Roeck
2025-01-18 17:09 ` David Laight
2025-01-18 17:49 ` Guenter Roeck
2025-01-18 18:09 ` David Laight
2025-01-18 18:36 ` Buiild error in i915/xe Guenter Roeck
2025-01-18 21:18 ` David Laight
2025-01-18 21:38 ` Guenter Roeck
2025-01-18 21:21 ` Buiild error in i915/xe (was: [PATCH next 4/7] minmax.h: Use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()) Linus Torvalds
2025-01-18 21:59 ` Buiild error in i915/xe Guenter Roeck
2025-01-18 22:04 ` Linus Torvalds
2025-01-18 22:11 ` Buiild error in i915/xe (was: [PATCH next 4/7] minmax.h: Use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()) David Laight
2025-01-18 22:58 ` Buiild error in i915/xe Guenter Roeck
2025-01-19 9:09 ` David Laight
2025-01-20 10:48 ` Jani Nikula
2025-01-20 11:15 ` David Laight
2025-01-20 11:21 ` Jani Nikula
2025-01-20 14:15 ` Guenter Roeck
2025-01-20 18:41 ` David Laight
2025-01-20 18:55 ` Andy Shevchenko
2025-01-20 19:14 ` Linus Torvalds
2025-01-21 5:58 ` Guenter Roeck
2025-01-18 23:24 ` Buiild error in i915/xe (was: [PATCH next 4/7] minmax.h: Use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()) Pedro Falcato
2024-11-18 19:14 ` [PATCH next 5/7] minmax.h: Move all the clamp() definitions after the min/max() ones David Laight
2024-11-18 19:15 ` [PATCH next 6/7] minmax.h: Simplify the variants of clamp() David Laight
2024-11-22 20:20 ` kernel test robot [this message]
2024-11-28 15:05 ` kernel test robot
2024-11-28 15:52 ` David Laight
2024-11-18 19:15 ` [PATCH next 7/7] minmax.h: Remove some #defines that are only expanded once David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202411230458.dhZwh3TT-lkp@intel.com \
--to=lkp@intel.com \
--cc=David.Laight@aculab.com \
--cc=Jason@zx2c4.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@kernel.org \
--cc=axboe@kernel.dk \
--cc=dan.carpenter@linaro.org \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mjguzik@gmail.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=pedro.falcato@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox