Messages in this thread | | | Date | Thu, 8 Aug 2019 10:44:27 +0800 | From | kbuild test robot <> | Subject | Re: [PATCH v2 2/2] linux/bits.h: Add compile time sanity check of GENMASK inputs |
| |
Hi Rikard,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master] [cannot apply to v5.3-rc3 next-20190807] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Rikard-Falkeborn/linux-bits-h-Clarify-macro-argument-names/20190805-024030 config: x86_64-randconfig-h003-201931 (attached as .config) compiler: gcc-7 (Debian 7.4.0-10) 7.4.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/bits.h:22:0, from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/delay.h:22, from drivers/iio/adc/max9611.c:20: drivers/iio/adc/max9611.c: In function 'max9611_init': include/linux/build_bug.h:16:45: error: negative width in bit-field '<anonymous>' #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); })) ^ >> include/linux/bits.h:24:18: note: in expansion of macro 'BUILD_BUG_ON_ZERO' ((unsigned long)BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ ^~~~~~~~~~~~~~~~~ >> include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' (GENMASK_INPUT_CHECK(high, low) + __GENMASK(high, low)) ^~~~~~~~~~~~~~~~~~~ >> drivers/iio/adc/max9611.c:86:28: note: in expansion of macro 'GENMASK' #define MAX9611_TEMP_MASK GENMASK(7, 15) ^~~~~~~ >> drivers/iio/adc/max9611.c:483:17: note: in expansion of macro 'MAX9611_TEMP_MASK' regval = ret & MAX9611_TEMP_MASK; ^~~~~~~~~~~~~~~~~ -- In file included from include/linux/bits.h:22:0, from include/linux/bitops.h:5, from include/linux/kernel.h:12, from include/linux/delay.h:22, from drivers/iio//adc/max9611.c:20: drivers/iio//adc/max9611.c: In function 'max9611_init': include/linux/build_bug.h:16:45: error: negative width in bit-field '<anonymous>' #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:(-!!(e)); })) ^ >> include/linux/bits.h:24:18: note: in expansion of macro 'BUILD_BUG_ON_ZERO' ((unsigned long)BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ ^~~~~~~~~~~~~~~~~ >> include/linux/bits.h:39:3: note: in expansion of macro 'GENMASK_INPUT_CHECK' (GENMASK_INPUT_CHECK(high, low) + __GENMASK(high, low)) ^~~~~~~~~~~~~~~~~~~ drivers/iio//adc/max9611.c:86:28: note: in expansion of macro 'GENMASK' #define MAX9611_TEMP_MASK GENMASK(7, 15) ^~~~~~~ drivers/iio//adc/max9611.c:483:17: note: in expansion of macro 'MAX9611_TEMP_MASK' regval = ret & MAX9611_TEMP_MASK; ^~~~~~~~~~~~~~~~~
vim +/BUILD_BUG_ON_ZERO +24 include/linux/bits.h
15 16 /* 17 * Create a contiguous bitmask starting at bit position @low and ending at 18 * position @high. For example 19 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. 20 */ 21 #ifndef __ASSEMBLY__ > 22 #include <linux/build_bug.h> 23 #define GENMASK_INPUT_CHECK(high, low) \ > 24 ((unsigned long)BUILD_BUG_ON_ZERO(__builtin_choose_expr( \ 25 __is_constexpr(high) && __is_constexpr(low), \ 26 (low) > (high), UL(0)))) 27 #else 28 /* 29 * BUILD_BUG_ON_ZERO and __is_constexpr() are not available in h files 30 * included from asm files, disable the input check if that is the case. 31 */ 32 #define GENMASK_INPUT_CHECK(high, low) UL(0) 33 #endif 34 35 #define __GENMASK(high, low) \ 36 (((~UL(0)) - (UL(1) << (low)) + 1) & \ 37 (~UL(0) >> (BITS_PER_LONG - 1 - (high)))) 38 #define GENMASK(high, low) \ > 39 (GENMASK_INPUT_CHECK(high, low) + __GENMASK(high, low)) 40
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [unhandled content-type:application/gzip] | |