tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 3c13c772fc233a10342c8e1605ff0855dfdf0c89 commit: 1fb50457684f1616ad05438cc16fd8f7d5b367b2 [2964/4552] bcachefs: Fix memory corruption in encryption path config: powerpc-randconfig-r006-20230912 (https://download.01.org/0day-ci/archive/20230913/202309130731.DmlgIRNJ-lkp@xxxxxxxxx/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230913/202309130731.DmlgIRNJ-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/202309130731.DmlgIRNJ-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): In file included from fs/bcachefs/checksum.c:2: In file included from fs/bcachefs/bcachefs.h:188: In file included from include/linux/bio.h:10: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from arch/powerpc/include/asm/hardirq.h:6: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/powerpc/include/asm/io.h:672: arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 47 | DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 48 | (p, b, c), pio, p) | ~~~~~~~~~~~~~~~~~~ arch/powerpc/include/asm/io.h:669:3: note: expanded from macro 'DEF_PCI_AC_NORET' 669 | __do_##name al; \ | ^~~~~~~~~~~~~~ <scratch space>:211:1: note: expanded from here 211 | __do_insl | ^ arch/powerpc/include/asm/io.h:611:56: note: expanded from macro '__do_insl' 611 | #define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n)) | ~~~~~~~~~~~~~~~~~~~~~^ In file included from fs/bcachefs/checksum.c:2: In file included from fs/bcachefs/bcachefs.h:188: In file included from include/linux/bio.h:10: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from arch/powerpc/include/asm/hardirq.h:6: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/powerpc/include/asm/io.h:672: arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 49 | DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 50 | (p, b, c), pio, p) | ~~~~~~~~~~~~~~~~~~ arch/powerpc/include/asm/io.h:669:3: note: expanded from macro 'DEF_PCI_AC_NORET' 669 | __do_##name al; \ | ^~~~~~~~~~~~~~ <scratch space>:213:1: note: expanded from here 213 | __do_outsb | ^ arch/powerpc/include/asm/io.h:612:58: note: expanded from macro '__do_outsb' 612 | #define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n)) | ~~~~~~~~~~~~~~~~~~~~~^ In file included from fs/bcachefs/checksum.c:2: In file included from fs/bcachefs/bcachefs.h:188: In file included from include/linux/bio.h:10: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from arch/powerpc/include/asm/hardirq.h:6: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/powerpc/include/asm/io.h:672: arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 51 | DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 52 | (p, b, c), pio, p) | ~~~~~~~~~~~~~~~~~~ arch/powerpc/include/asm/io.h:669:3: note: expanded from macro 'DEF_PCI_AC_NORET' 669 | __do_##name al; \ | ^~~~~~~~~~~~~~ <scratch space>:215:1: note: expanded from here 215 | __do_outsw | ^ arch/powerpc/include/asm/io.h:613:58: note: expanded from macro '__do_outsw' 613 | #define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n)) | ~~~~~~~~~~~~~~~~~~~~~^ In file included from fs/bcachefs/checksum.c:2: In file included from fs/bcachefs/bcachefs.h:188: In file included from include/linux/bio.h:10: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:12: In file included from include/linux/hardirq.h:11: In file included from arch/powerpc/include/asm/hardirq.h:6: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/powerpc/include/asm/io.h:672: arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 53 | DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 54 | (p, b, c), pio, p) | ~~~~~~~~~~~~~~~~~~ arch/powerpc/include/asm/io.h:669:3: note: expanded from macro 'DEF_PCI_AC_NORET' 669 | __do_##name al; \ | ^~~~~~~~~~~~~~ <scratch space>:217:1: note: expanded from here 217 | __do_outsl | ^ arch/powerpc/include/asm/io.h:614:58: note: expanded from macro '__do_outsl' 614 | #define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n)) | ~~~~~~~~~~~~~~~~~~~~~^ >> fs/bcachefs/checksum.c:141:22: warning: comparison of distinct pointer types ('typeof (len) *' (aka 'unsigned int *') and 'typeof ((1UL << 12) - offset) *' (aka 'unsigned long *')) [-Wcompare-distinct-pointer-types] 141 | unsigned pg_len = min(len, PAGE_SIZE - offset); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:68:19: note: expanded from macro 'min' 68 | #define min(x, y) __careful_cmp(x, y, <) | ^~~~~~~~~~~~~~~~~~~~~~ include/linux/minmax.h:37:24: note: expanded from macro '__careful_cmp' 37 | __builtin_choose_expr(__safe_cmp(x, y), \ | ^~~~~~~~~~~~~~~~ include/linux/minmax.h:27:4: note: expanded from macro '__safe_cmp' 27 | (__typecheck(x, y) && __no_side_effects(x, y)) | ^~~~~~~~~~~~~~~~~ include/linux/minmax.h:21:28: note: expanded from macro '__typecheck' 21 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) | ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ 7 warnings generated. Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for HOTPLUG_CPU Depends on [n]: SMP [=y] && (PPC_PSERIES [=n] || PPC_PMAC [=n] || PPC_POWERNV [=n] || FSL_SOC_BOOKE [=n]) Selected by [y]: - PM_SLEEP_SMP [=y] && SMP [=y] && (ARCH_SUSPEND_POSSIBLE [=n] || ARCH_HIBERNATION_POSSIBLE [=y]) && PM_SLEEP [=y] vim +141 fs/bcachefs/checksum.c 112 113 static inline int do_encrypt(struct crypto_sync_skcipher *tfm, 114 struct nonce nonce, 115 void *buf, size_t len) 116 { 117 if (!is_vmalloc_addr(buf)) { 118 struct scatterlist sg; 119 120 sg_init_table(&sg, 1); 121 sg_set_page(&sg, 122 is_vmalloc_addr(buf) 123 ? vmalloc_to_page(buf) 124 : virt_to_page(buf), 125 len, offset_in_page(buf)); 126 return do_encrypt_sg(tfm, nonce, &sg, len); 127 } else { 128 unsigned pages = buf_pages(buf, len); 129 struct scatterlist *sg; 130 size_t orig_len = len; 131 int ret, i; 132 133 sg = kmalloc_array(sizeof(*sg), pages, GFP_KERNEL); 134 if (!sg) 135 return -ENOMEM; 136 137 sg_init_table(sg, pages); 138 139 for (i = 0; i < pages; i++) { 140 unsigned offset = offset_in_page(buf); > 141 unsigned pg_len = min(len, PAGE_SIZE - offset); 142 143 sg_set_page(sg + i, vmalloc_to_page(buf), pg_len, offset); 144 buf += pg_len; 145 len -= pg_len; 146 } 147 148 ret = do_encrypt_sg(tfm, nonce, sg, orig_len); 149 kfree(sg); 150 return ret; 151 } 152 } 153 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki