tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable head: 275d686abcb590d862b74e2670533d93fd10e58c commit: 2900cb53f7d7d47f73c4c368c0db15a2c6df3e72 [18/225] lib/stackdepot: double DEPOT_POOLS_CAP if KASAN is enabled config: um-allnoconfig (https://download.01.org/0day-ci/archive/20240808/202408082056.0xMOdtbe-lkp@xxxxxxxxx/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240808/202408082056.0xMOdtbe-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/202408082056.0xMOdtbe-lkp@xxxxxxxxx/ All error/warnings (new ones prefixed by >>): In file included from lib/stackdepot.c:36: In file included from include/linux/memblock.h:13: In file included from arch/um/include/asm/dma.h:5: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 548 | val = __raw_readb(PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' 37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) | ^ In file included from lib/stackdepot.c:36: In file included from include/linux/memblock.h:13: In file included from arch/um/include/asm/dma.h:5: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' 35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) | ^ In file included from lib/stackdepot.c:36: In file included from include/linux/memblock.h:13: In file included from arch/um/include/asm/dma.h:5: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 585 | __raw_writeb(value, PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 693 | readsb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 701 | readsw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 709 | readsl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 718 | writesb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 727 | writesw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 736 | writesl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ >> lib/stackdepot.c:66:26: error: call to undeclared function 'MIN'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] 66 | static void *stack_pools[DEPOT_MAX_POOLS]; | ^ lib/stackdepot.c:44:2: note: expanded from macro 'DEPOT_MAX_POOLS' 44 | MIN((1LL << (DEPOT_POOL_INDEX_BITS)) - 1, DEPOT_POOLS_CAP) | ^ >> lib/stackdepot.c:66:26: warning: variable length array used [-Wvla] 66 | static void *stack_pools[DEPOT_MAX_POOLS]; | ^~~~~~~~~~~~~~~ lib/stackdepot.c:44:2: note: expanded from macro 'DEPOT_MAX_POOLS' 44 | MIN((1LL << (DEPOT_POOL_INDEX_BITS)) - 1, DEPOT_POOLS_CAP) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> lib/stackdepot.c:66:14: error: variable length array declaration not allowed at file scope 66 | static void *stack_pools[DEPOT_MAX_POOLS]; | ^ ~~~~~~~~~~~~~~~ 13 warnings and 2 errors generated. vim +/MIN +66 lib/stackdepot.c 2900cb53f7d7d4 Waiman Long 2024-08-07 41 3ee34eabac2abb Oscar Salvador 2024-02-15 42 /* The pool_index is offset by 1 so the first record does not have a 0 handle. */ 424cafee4a9c66 Andrey Konovalov 2023-02-10 43 #define DEPOT_MAX_POOLS \ 2900cb53f7d7d4 Waiman Long 2024-08-07 @44 MIN((1LL << (DEPOT_POOL_INDEX_BITS)) - 1, DEPOT_POOLS_CAP) cd11016e5f5212 Alexander Potapenko 2016-03-25 45 735df3c3a3493c Andrey Konovalov 2023-02-10 46 static bool stack_depot_disabled; 1c0310add78e7e Andrey Konovalov 2023-02-10 47 static bool __stack_depot_early_init_requested __initdata = IS_ENABLED(CONFIG_STACKDEPOT_ALWAYS_INIT); a5f1783be29ada Vlastimil Babka 2022-03-02 48 static bool __stack_depot_early_init_passed __initdata; a5f1783be29ada Vlastimil Babka 2022-03-02 49 0d249ac0e07680 Andrey Konovalov 2023-02-10 50 /* Use one hash table bucket per 16 KB of memory. */ 4c2e9a679468a5 Andrey Konovalov 2023-02-10 51 #define STACK_HASH_TABLE_SCALE 14 0d249ac0e07680 Andrey Konovalov 2023-02-10 52 /* Limit the number of buckets between 4K and 1M. */ 4c2e9a679468a5 Andrey Konovalov 2023-02-10 53 #define STACK_BUCKET_NUMBER_ORDER_MIN 12 4c2e9a679468a5 Andrey Konovalov 2023-02-10 54 #define STACK_BUCKET_NUMBER_ORDER_MAX 20 0d249ac0e07680 Andrey Konovalov 2023-02-10 55 /* Initial seed for jhash2. */ cd11016e5f5212 Alexander Potapenko 2016-03-25 56 #define STACK_HASH_SEED 0x9747b28c cd11016e5f5212 Alexander Potapenko 2016-03-25 57 4805180bc16523 Andrey Konovalov 2023-11-20 58 /* Hash table of stored stack records. */ 4805180bc16523 Andrey Konovalov 2023-11-20 59 static struct list_head *stack_table; 0d249ac0e07680 Andrey Konovalov 2023-02-10 60 /* Fixed order of the number of table buckets. Used when KASAN is enabled. */ 4c2e9a679468a5 Andrey Konovalov 2023-02-10 61 static unsigned int stack_bucket_number_order; 0d249ac0e07680 Andrey Konovalov 2023-02-10 62 /* Hash mask for indexing the table. */ f9987921cb541b Vlastimil Babka 2022-06-20 63 static unsigned int stack_hash_mask; f9987921cb541b Vlastimil Babka 2022-06-20 64 4805180bc16523 Andrey Konovalov 2023-11-20 65 /* Array of memory regions that store stack records. */ 424cafee4a9c66 Andrey Konovalov 2023-02-10 @66 static void *stack_pools[DEPOT_MAX_POOLS]; a5d21f71715a04 Andrey Konovalov 2023-11-20 67 /* Newly allocated pool that is not yet added to stack_pools. */ a5d21f71715a04 Andrey Konovalov 2023-11-20 68 static void *new_pool; b29d3188581400 Andrey Konovalov 2023-11-20 69 /* Number of pools in stack_pools. */ b29d3188581400 Andrey Konovalov 2023-11-20 70 static int pools_num; 31639fd6cebd4f Marco Elver 2024-01-29 71 /* Offset to the unused space in the currently used pool. */ 31639fd6cebd4f Marco Elver 2024-01-29 72 static size_t pool_offset = DEPOT_POOL_SIZE; 4805180bc16523 Andrey Konovalov 2023-11-20 73 /* Freelist of stack records within stack_pools. */ 4805180bc16523 Andrey Konovalov 2023-11-20 74 static LIST_HEAD(free_stacks); 4434a56ec20925 Marco Elver 2024-01-18 75 /* The lock must be held when performing pool or freelist modifications. */ 4434a56ec20925 Marco Elver 2024-01-18 76 static DEFINE_RAW_SPINLOCK(pool_lock); e1fdc403349c64 Vijayanand Jitta 2021-02-25 77 :::::: The code at line 66 was first introduced by commit :::::: 424cafee4a9c66435d8b86e7edbc794c116b52a5 lib/stackdepot: rename handle and pool constants :::::: TO: Andrey Konovalov <andreyknvl@xxxxxxxxxx> :::::: CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki