From: kernel test robot <lkp@intel.com>
To: David Laight <David.Laight@aculab.com>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
'Andy Shevchenko' <andriy.shevchenko@linux.intel.com>,
'Andrew Morton' <akpm@linux-foundation.org>,
"'Matthew Wilcox (Oracle)'" <willy@infradead.org>,
'Christoph Hellwig' <hch@infradead.org>,
"'Jason A. Donenfeld'" <Jason@zx2c4.com>
Cc: oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.
Date: Wed, 26 Jul 2023 03:36:33 +0800 [thread overview]
Message-ID: <202307260303.3ftEpZRU-lkp@intel.com> (raw)
In-Reply-To: <48c2cd0407f14859919d4fcbe526234a@AcuMS.aculab.com>
Hi David,
kernel test robot noticed the following build warnings:
[auto build test WARNING on akpm-mm/mm-everything]
[also build test WARNING on linus/master v6.5-rc3 next-20230725]
[cannot apply to next-20230725]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/David-Laight/minmax-Allow-min-max-clamp-if-the-arguments-have-the-same-signedness/20230725-204940
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/48c2cd0407f14859919d4fcbe526234a%40AcuMS.aculab.com
patch subject: [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.
config: riscv-randconfig-r024-20230725 (https://download.01.org/0day-ci/archive/20230726/202307260303.3ftEpZRU-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230726/202307260303.3ftEpZRU-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/202307260303.3ftEpZRU-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from include/linux/kernel.h:27,
from include/linux/cpumask.h:10,
from include/linux/smp.h:13,
from include/linux/lockdep.h:14,
from include/linux/mutex.h:17,
from include/linux/notifier.h:14,
from include/linux/kprobes.h:21,
from include/linux/kgdb.h:19,
from include/linux/fb.h:6,
from drivers/gpu/drm/drm_modes.c:35:
drivers/gpu/drm/drm_modes.c: In function 'drm_mode_parse_command_line_for_connector':
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:36:27: note: in definition of macro '__cmp'
36 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:47:27: note: in expansion of macro '__int_const'
47 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:36:45: note: in definition of macro '__cmp'
36 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:47:43: note: in expansion of macro '__int_const'
47 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:36:51: note: in definition of macro '__cmp'
36 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:47:27: note: in expansion of macro '__int_const'
47 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:36:57: note: in definition of macro '__cmp'
36 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:47:43: note: in expansion of macro '__int_const'
47 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:39:16: note: in expansion of macro '__int_const'
39 | typeof(__int_const(x)) unique_x = (x); \
| ^~~~~~~~~~~
include/linux/minmax.h:48:17: note: in expansion of macro '__cmp_once'
48 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:25:47: note: in expansion of macro '__is_noneg_int'
25 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:40:16: note: in expansion of macro '__int_const'
40 | typeof(__int_const(y)) unique_y = (y); \
| ^~~~~~~~~~~
include/linux/minmax.h:48:17: note: in expansion of macro '__cmp_once'
48 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
In file included from include/linux/init.h:5,
from include/linux/printk.h:6,
from include/asm-generic/bug.h:22,
from arch/riscv/include/asm/bug.h:83,
from include/linux/bug.h:5,
from arch/riscv/include/asm/cmpxchg.h:9,
from arch/riscv/include/asm/atomic.h:19,
from include/linux/atomic.h:7,
from include/linux/refcount.h:95,
from include/linux/fb.h:5:
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
include/linux/minmax.h:41:9: note: in expansion of macro 'static_assert'
41 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:31:17: note: in expansion of macro '__is_noneg_int'
31 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:41:23: note: in expansion of macro '__types_ok'
41 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:48:17: note: in expansion of macro '__cmp_once'
48 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
>> include/linux/minmax.h:23:22: warning: ordered comparison of pointer with integer zero [-Wextra]
23 | ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/build_bug.h:78:56: note: in definition of macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
include/linux/minmax.h:41:9: note: in expansion of macro 'static_assert'
41 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:31:38: note: in expansion of macro '__is_noneg_int'
31 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:41:23: note: in expansion of macro '__types_ok'
41 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:48:17: note: in expansion of macro '__cmp_once'
48 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:81:25: note: in expansion of macro '__careful_cmp'
81 | #define max(x, y) __careful_cmp(max, x, y)
| ^~~~~~~~~~~~~
drivers/gpu/drm/drm_modes.c:2474:29: note: in expansion of macro 'max'
2474 | extra_ptr = max(bpp_end_ptr, refresh_end_ptr);
| ^~~
vim +23 include/linux/minmax.h
6
7 /*
8 * min()/max()/clamp() macros must accomplish three things:
9 *
10 * - Avoid multiple evaluations of the arguments (so side-effects like
11 * "x++" happen only once) when non-constant.
12 * - Perform signed v unsigned type-checking (to generate compile
13 * errors instead of nasty runtime surprises).
14 * Constants from 0 to INT_MAX are cast to (int) so can be used
15 * in comparisons with signed types.
16 * - Retain result as a constant expressions when called with only
17 * constant expressions (to avoid tripping VLA warnings in stack
18 * allocation usage).
19 */
20
21 #define __is_noneg_int(x) \
22 __builtin_choose_expr(!__is_constexpr(x), false, \
> 23 ((x) >= 0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
24
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next parent reply other threads:[~2023-07-25 19:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <48c2cd0407f14859919d4fcbe526234a@AcuMS.aculab.com>
2023-07-25 19:36 ` kernel test robot [this message]
2023-07-26 9:29 ` [PATCH next resend 5/5] minmax: Relax check to allow comparison between int and small unsigned constants David Laight
2023-07-27 5:20 ` kernel test robot
2023-07-28 7:15 ` kernel test robot
2023-07-28 8:08 ` kernel test robot
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=202307260303.3ftEpZRU-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=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=oe-kbuild-all@lists.linux.dev \
--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;
as well as URLs for NNTP newsgroup(s).