[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202411230458.dhZwh3TT-lkp@intel.com>
Date: Sat, 23 Nov 2024 04:20:02 +0800
From: kernel test robot <lkp@...el.com>
To: David Laight <David.Laight@...lab.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Cc: oe-kbuild-all@...ts.linux.dev, LKML <linux-kernel@...r.kernel.org>,
'Arnd Bergmann' <arnd@...nel.org>, 'Jens Axboe' <axboe@...nel.dk>,
'Matthew Wilcox' <willy@...radead.org>,
'Christoph Hellwig' <hch@...radead.org>,
'Andrew Morton' <akpm@...ux-foundation.org>,
Linux Memory Management List <linux-mm@...ck.org>,
'Andy Shevchenko' <andriy.shevchenko@...ux.intel.com>,
'Dan Carpenter' <dan.carpenter@...aro.org>,
"'Jason A . Donenfeld'" <Jason@...c4.com>,
"'pedro.falcato@...il.com'" <pedro.falcato@...il.com>,
'Mateusz Guzik' <mjguzik@...il.com>,
'Lorenzo Stoakes' <lorenzo.stoakes@...cle.com>
Subject: Re: [PATCH next 6/7] minmax.h: Simplify the variants of clamp()
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@...el.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
Powered by blists - more mailing lists