Hi Emil, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on tegra-drm/drm/tegra/for-next] [also build test WARNING on linus/master v5.7-rc6 next-20200518] [cannot apply to linux/master] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Emil-Velikov/linux-bits-h-adjust-GENMASK_INPUT_CHECK-check/20200519-205452 base: git://anongit.freedesktop.org/tegra/linux.git drm/tegra/for-next config: arc-defconfig (attached as .config) compiler: arc-elf-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot All warnings (new ones prefixed by >>, old ones prefixed by <<): In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from drivers/clk/clk-multiplier.c:6: drivers/clk/clk-multiplier.c: In function 'clk_multiplier_recalc_rate': include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ >> drivers/clk/clk-multiplier.c:48:9: note: in expansion of macro 'GENMASK' 48 | val &= GENMASK(mult->width - 1, 0); | ^~~~~~~ drivers/clk/clk-multiplier.c: In function 'clk_multiplier_set_rate': include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ drivers/clk/clk-multiplier.c:139:10: note: in expansion of macro 'GENMASK' 139 | val &= ~GENMASK(mult->width + mult->shift - 1, mult->shift); | ^~~~~~~ -- In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from include/linux/of.h:15, from include/linux/clk-provider.h:9, from drivers/clk/clk-fractional-divider.c:10: drivers/clk/clk-fractional-divider.c: In function 'clk_fd_general_approximation': include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ >> drivers/clk/clk-fractional-divider.c:88:4: note: in expansion of macro 'GENMASK' 88 | GENMASK(fd->mwidth - 1, 0), GENMASK(fd->nwidth - 1, 0), | ^~~~~~~ include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ drivers/clk/clk-fractional-divider.c:88:32: note: in expansion of macro 'GENMASK' 88 | GENMASK(fd->mwidth - 1, 0), GENMASK(fd->nwidth - 1, 0), | ^~~~~~~ drivers/clk/clk-fractional-divider.c: In function 'clk_fd_set_rate': include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ drivers/clk/clk-fractional-divider.c:122:4: note: in expansion of macro 'GENMASK' 122 | GENMASK(fd->mwidth - 1, 0), GENMASK(fd->nwidth - 1, 0), | ^~~~~~~ include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ drivers/clk/clk-fractional-divider.c:122:32: note: in expansion of macro 'GENMASK' 122 | GENMASK(fd->mwidth - 1, 0), GENMASK(fd->nwidth - 1, 0), | ^~~~~~~ drivers/clk/clk-fractional-divider.c: In function 'clk_hw_register_fractional_divider': include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ drivers/clk/clk-fractional-divider.c:178:14: note: in expansion of macro 'GENMASK' 178 | fd->mmask = GENMASK(mwidth - 1, 0) << mshift; | ^~~~~~~ include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ drivers/clk/clk-fractional-divider.c:181:14: note: in expansion of macro 'GENMASK' 181 | fd->nmask = GENMASK(nwidth - 1, 0) << nshift; | ^~~~~~~ -- In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/interrupt.h:6, from drivers/clocksource/arc_timer.c:15: include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 45 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/clocksource.h:136:32: note: in expansion of macro 'GENMASK_ULL' 136 | #define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0) | ^~~~~~~~~~~ >> drivers/clocksource/arc_timer.c:99:12: note: in expansion of macro 'CLOCKSOURCE_MASK' 99 | .mask = CLOCKSOURCE_MASK(64), | ^~~~~~~~~~~~~~~~ include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 45 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/clocksource.h:136:32: note: in expansion of macro 'GENMASK_ULL' 136 | #define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0) | ^~~~~~~~~~~ drivers/clocksource/arc_timer.c:157:12: note: in expansion of macro 'CLOCKSOURCE_MASK' 157 | .mask = CLOCKSOURCE_MASK(64), | ^~~~~~~~~~~~~~~~ include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:45:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 45 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/linux/clocksource.h:136:32: note: in expansion of macro 'GENMASK_ULL' 136 | #define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0) | ^~~~~~~~~~~ drivers/clocksource/arc_timer.c:210:12: note: in expansion of macro 'CLOCKSOURCE_MASK' 210 | .mask = CLOCKSOURCE_MASK(32), | ^~~~~~~~~~~~~~~~ -- In file included from include/linux/kernel.h:11, from include/linux/list.h:9, from include/linux/module.h:12, from net/core/filter.c:20: net/core/filter.c: In function '____bpf_skb_set_tunnel_opt': include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' 78 | # define unlikely(x) __builtin_expect(!!(x), 0) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/net/ip_tunnels.h:66:2: note: in expansion of macro 'GENMASK' 66 | GENMASK((sizeof_field(struct ip_tunnel_info, | ^~~~~~~ net/core/filter.c:3945:22: note: in expansion of macro 'IP_TUNNEL_OPTS_MAX' 3945 | if (unlikely(size > IP_TUNNEL_OPTS_MAX)) | ^~~~~~~~~~~~~~~~~~ In file included from include/linux/bits.h:23, from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/list.h:9, from include/linux/module.h:12, from net/core/filter.c:20: net/core/filter.c: In function 'bpf_get_skb_set_tunnel_proto': include/linux/build_bug.h:16:51: error: negative width in bit-field '' 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); }))) | ^ include/linux/bits.h:25:3: note: in expansion of macro 'BUILD_BUG_ON_ZERO' 25 | (BUILD_BUG_ON_ZERO(!__builtin_choose_expr( | ^~~~~~~~~~~~~~~~~ include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~ include/net/ip_tunnels.h:66:2: note: in expansion of macro 'GENMASK' 66 | GENMASK((sizeof_field(struct ip_tunnel_info, | ^~~~~~~ net/core/filter.c:3968:35: note: in expansion of macro 'IP_TUNNEL_OPTS_MAX' 3968 | tmp = metadata_dst_alloc_percpu(IP_TUNNEL_OPTS_MAX, | ^~~~~~~~~~~~~~~~~~ In file included from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/list.h:9, from include/linux/module.h:12, from net/core/filter.c:20: >> include/linux/bits.h:39:2: warning: conversion from 'long unsigned int' to 'u8' {aka 'unsigned char'} changes value from '256' to '0' [-Woverflow] 39 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/net/ip_tunnels.h:66:2: note: in expansion of macro 'GENMASK' 66 | GENMASK((sizeof_field(struct ip_tunnel_info, | ^~~~~~~ net/core/filter.c:3968:35: note: in expansion of macro 'IP_TUNNEL_OPTS_MAX' 3968 | tmp = metadata_dst_alloc_percpu(IP_TUNNEL_OPTS_MAX, | ^~~~~~~~~~~~~~~~~~ vim +39 include/linux/bits.h 295bcca84916cb Rikard Falkeborn 2020-04-06 34 295bcca84916cb Rikard Falkeborn 2020-04-06 35 #define __GENMASK(h, l) \ 95b980d62d52c4 Masahiro Yamada 2019-07-16 36 (((~UL(0)) - (UL(1) << (l)) + 1) & \ 95b980d62d52c4 Masahiro Yamada 2019-07-16 37 (~UL(0) >> (BITS_PER_LONG - 1 - (h)))) 295bcca84916cb Rikard Falkeborn 2020-04-06 38 #define GENMASK(h, l) \ 295bcca84916cb Rikard Falkeborn 2020-04-06 @39 (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) 8bd9cb51daac89 Will Deacon 2018-06-19 40 :::::: The code at line 39 was first introduced by commit :::::: 295bcca84916cb5079140a89fccb472bb8d1f6e2 linux/bits.h: add compile time sanity check of GENMASK inputs :::::: TO: Rikard Falkeborn :::::: CC: Linus Torvalds --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org