Re: [PATCH next v2 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.

From: kernel test robot
Date: Fri Jul 28 2023 - 17:43:33 EST


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 crng-random/master v6.5-rc3 next-20230728]
[cannot apply to next-20230728]
[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-Add-min_unsigned-a-b-and-max_unsigned-a-b/20230728-225439
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/b4ce9dad748e489f9314a2dc95615033%40AcuMS.aculab.com
patch subject: [PATCH next v2 5/5] minmax: Relax check to allow comparison between int and small unsigned constants.
config: alpha-randconfig-r024-20230727 (https://download.01.org/0day-ci/archive/20230729/202307290538.EtRKfGgC-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230729/202307290538.EtRKfGgC-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307290538.EtRKfGgC-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/kernel.h:27,
from include/linux/cpumask.h:10,
from include/linux/mm_types_task.h:14,
from include/linux/mm_types.h:5,
from include/linux/buildid.h:5,
from include/linux/module.h:14,
from net/ceph/osdmap.c:5:
net/ceph/osdmap.c: In function 'osdmap_decode':
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:27: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:27: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:1773:54: note: in expansion of macro 'min'
1773 | err = osdmap_set_crush(map, crush_decode(*p, min(*p + len, end)));
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:45: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:43: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:1773:54: note: in expansion of macro 'min'
1773 | err = osdmap_set_crush(map, crush_decode(*p, min(*p + len, end)));
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:51: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:27: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:1773:54: note: in expansion of macro 'min'
1773 | err = osdmap_set_crush(map, crush_decode(*p, min(*p + len, end)));
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:57: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:43: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:1773:54: note: in expansion of macro 'min'
1773 | err = osdmap_set_crush(map, crush_decode(*p, min(*p + len, end)));
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:42:16: note: in expansion of macro '__int_const'
42 | typeof(__int_const(x)) unique_x = (x); \
| ^~~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:1773:54: note: in expansion of macro 'min'
1773 | err = osdmap_set_crush(map, crush_decode(*p, min(*p + len, end)));
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:43:16: note: in expansion of macro '__int_const'
43 | typeof(__int_const(y)) unique_y = (y); \
| ^~~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:1773:54: note: in expansion of macro 'min'
1773 | err = osdmap_set_crush(map, crush_decode(*p, min(*p + len, end)));
| ^~~
In file included from include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/module.h:12:
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(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:44:9: note: in expansion of macro 'static_assert'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:34:17: note: in expansion of macro '__is_noneg_int'
34 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:44:23: note: in expansion of macro '__types_ok'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:1773:54: note: in expansion of macro 'min'
1773 | err = osdmap_set_crush(map, crush_decode(*p, min(*p + len, end)));
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(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:44:9: note: in expansion of macro 'static_assert'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:34:38: note: in expansion of macro '__is_noneg_int'
34 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:44:23: note: in expansion of macro '__types_ok'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:1773:54: note: in expansion of macro 'min'
1773 | err = osdmap_set_crush(map, crush_decode(*p, min(*p + len, end)));
| ^~~
net/ceph/osdmap.c: In function 'osdmap_apply_incremental':
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:27: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:27: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2000:46: note: in expansion of macro 'min'
2000 | return ceph_osdmap_decode(p, min(*p+len, end), msgr2);
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:45: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:43: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2000:46: note: in expansion of macro 'min'
2000 | return ceph_osdmap_decode(p, min(*p+len, end), msgr2);
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:51: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:27: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2000:46: note: in expansion of macro 'min'
2000 | return ceph_osdmap_decode(p, min(*p+len, end), msgr2);
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:57: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:43: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2000:46: note: in expansion of macro 'min'
2000 | return ceph_osdmap_decode(p, min(*p+len, end), msgr2);
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:42:16: note: in expansion of macro '__int_const'
42 | typeof(__int_const(x)) unique_x = (x); \
| ^~~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2000:46: note: in expansion of macro 'min'
2000 | return ceph_osdmap_decode(p, min(*p+len, end), msgr2);
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:43:16: note: in expansion of macro '__int_const'
43 | typeof(__int_const(y)) unique_y = (y); \
| ^~~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2000:46: note: in expansion of macro 'min'
2000 | return ceph_osdmap_decode(p, min(*p+len, end), msgr2);
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(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:44:9: note: in expansion of macro 'static_assert'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:34:17: note: in expansion of macro '__is_noneg_int'
34 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:44:23: note: in expansion of macro '__types_ok'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2000:46: note: in expansion of macro 'min'
2000 | return ceph_osdmap_decode(p, min(*p+len, end), msgr2);
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(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:44:9: note: in expansion of macro 'static_assert'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:34:38: note: in expansion of macro '__is_noneg_int'
34 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:44:23: note: in expansion of macro '__types_ok'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2000:46: note: in expansion of macro 'min'
2000 | return ceph_osdmap_decode(p, min(*p+len, end), msgr2);
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:27: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:27: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2007:57: note: in expansion of macro 'min'
2007 | crush_decode(*p, min(*p + len, end)));
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:45: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:43: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2007:57: note: in expansion of macro 'min'
2007 | crush_decode(*p, min(*p + len, end)));
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:51: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:27: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2007:57: note: in expansion of macro 'min'
2007 | crush_decode(*p, min(*p + len, end)));
| ^~~
>> include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:39:57: note: in definition of macro '__cmp'
39 | #define __cmp(op, x, y) ((x) __cmp_op_##op (y) ? (x) : (y))
| ^
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:50:43: note: in expansion of macro '__int_const'
50 | __cmp(op, __int_const(x), __int_const(y)), \
| ^~~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2007:57: note: in expansion of macro 'min'
2007 | crush_decode(*p, min(*p + len, end)));
| ^~~
include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:42:16: note: in expansion of macro '__int_const'
42 | typeof(__int_const(x)) unique_x = (x); \
| ^~~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2007:57: note: in expansion of macro 'min'
2007 | crush_decode(*p, min(*p + len, end)));
| ^~~
include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
| ^~
include/linux/minmax.h:28:47: note: in expansion of macro '__is_noneg_int'
28 | #define __int_const(x) __builtin_choose_expr(__is_noneg_int(x), (int)(long)(x), (x))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:43:16: note: in expansion of macro '__int_const'
43 | typeof(__int_const(y)) unique_y = (y); \
| ^~~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2007:57: note: in expansion of macro 'min'
2007 | crush_decode(*p, min(*p + len, end)));
| ^~~
include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(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:44:9: note: in expansion of macro 'static_assert'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:34:17: note: in expansion of macro '__is_noneg_int'
34 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:44:23: note: in expansion of macro '__types_ok'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2007:57: note: in expansion of macro 'min'
2007 | crush_decode(*p, min(*p + len, end)));
| ^~~
include/linux/minmax.h:26:22: warning: ordered comparison of pointer with null pointer [-Wextra]
26 | ((x) >= (typeof(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:44:9: note: in expansion of macro 'static_assert'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~~~~
include/linux/minmax.h:34:38: note: in expansion of macro '__is_noneg_int'
34 | __is_noneg_int(x) || __is_noneg_int(y))
| ^~~~~~~~~~~~~~
include/linux/minmax.h:44:23: note: in expansion of macro '__types_ok'
44 | static_assert(__types_ok(x, y), \
| ^~~~~~~~~~
include/linux/minmax.h:51:17: note: in expansion of macro '__cmp_once'
51 | __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
| ^~~~~~~~~~
include/linux/minmax.h:78:25: note: in expansion of macro '__careful_cmp'
78 | #define min(x, y) __careful_cmp(min, x, y)
| ^~~~~~~~~~~~~
net/ceph/osdmap.c:2007:57: note: in expansion of macro 'min'
2007 | crush_decode(*p, min(*p + len, end)));
..


vim +26 include/linux/minmax.h

7
8 /*
9 * min()/max()/clamp() macros must accomplish three things:
10 *
11 * - Avoid multiple evaluations of the arguments (so side-effects like
12 * "x++" happen only once) when non-constant.
13 * - Perform signed v unsigned type-checking (to generate compile
14 * errors instead of nasty runtime surprises).
15 * Constants from 0 to INT_MAX are cast to (int) so can be used
16 * in comparisons with signed types.
17 * - Retain result as a constant expressions when called with only
18 * constant expressions (to avoid tripping VLA warnings in stack
19 * allocation usage).
20 */
21 #define __typecheck(x, y) \
22 (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
23
24 #define __is_noneg_int(x) \
25 __builtin_choose_expr(!__is_constexpr(x), false, \
> 26 ((x) >= (typeof(x))0 && (x) <= (typeof((x) + 0))(long)__INT_MAX__))
27

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki