[djwong-xfs:zero-initialize-pmem 453/453] fs/ext4/extents.c:4519:34: warning: variable 'start' is uninitialized when used here

From: kernel test robot
Date: Sat Sep 04 2021 - 01:57:01 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git zero-initialize-pmem
head: 61c7fc9c24078b799a75566e4102bfe967b05664
commit: 61c7fc9c24078b799a75566e4102bfe967b05664 [453/453] ext4: implement FALLOC_FL_ZEROINIT_RANGE
config: powerpc64-randconfig-r016-20210904 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 6fe2beba7d2a41964af658c8c59dd172683ef739)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=61c7fc9c24078b799a75566e4102bfe967b05664
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git fetch --no-tags djwong-xfs zero-initialize-pmem
git checkout 61c7fc9c24078b799a75566e4102bfe967b05664
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:36:1: note: expanded from here
__do_insw
^
arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/ext4/extents.c:22:
In file included from include/linux/jbd2.h:23:
In file included from include/linux/buffer_head.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
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:619:
arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:38:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/ext4/extents.c:22:
In file included from include/linux/jbd2.h:23:
In file included from include/linux/buffer_head.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
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:619:
arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:40:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/ext4/extents.c:22:
In file included from include/linux/jbd2.h:23:
In file included from include/linux/buffer_head.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
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:619:
arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:42:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from fs/ext4/extents.c:22:
In file included from include/linux/jbd2.h:23:
In file included from include/linux/buffer_head.h:14:
In file included from include/linux/pagemap.h:11:
In file included from include/linux/highmem.h:10:
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:619:
arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:44:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
>> fs/ext4/extents.c:4519:34: warning: variable 'start' is uninitialized when used here [-Wuninitialized]
truncate_pagecache_range(inode, start, end - 1);
^~~~~
fs/ext4/extents.c:4478:14: note: initialize the variable 'start' to silence this warning
loff_t start, end;
^
= 0
>> fs/ext4/extents.c:4519:41: warning: variable 'end' is uninitialized when used here [-Wuninitialized]
truncate_pagecache_range(inode, start, end - 1);
^~~
fs/ext4/extents.c:4478:19: note: initialize the variable 'end' to silence this warning
loff_t start, end;
^
= 0
14 warnings generated.


vim +/start +4519 fs/ext4/extents.c

4473
4474 static long ext4_zeroinit_range(struct file *file, loff_t offset, loff_t len)
4475 {
4476 struct inode *inode = file_inode(file);
4477 handle_t *handle = NULL;
4478 loff_t start, end;
4479 long ret;
4480
4481 trace_ext4_zeroinit_range(inode, offset, len,
4482 FALLOC_FL_ZEROINIT_RANGE | FALLOC_FL_KEEP_SIZE);
4483
4484 /* We don't support data=journal mode */
4485 if (ext4_should_journal_data(inode))
4486 return -EOPNOTSUPP;
4487
4488 inode_lock(inode);
4489
4490 /*
4491 * Indirect files do not support unwritten extents
4492 */
4493 if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
4494 ret = -EOPNOTSUPP;
4495 goto out_mutex;
4496 }
4497
4498 /* Wait all existing dio workers, newcomers will block on i_mutex */
4499 inode_dio_wait(inode);
4500
4501 /*
4502 * Prevent page faults from reinstantiating pages we have released from
4503 * page cache.
4504 */
4505 down_write(&EXT4_I(inode)->i_mmap_sem);
4506
4507 ret = ext4_break_layouts(inode);
4508 if (ret) {
4509 up_write(&EXT4_I(inode)->i_mmap_sem);
4510 goto out_mutex;
4511 }
4512
4513 ret = ext4_update_disksize_before_punch(inode, offset, len);
4514 if (ret) {
4515 up_write(&EXT4_I(inode)->i_mmap_sem);
4516 goto out_mutex;
4517 }
4518 /* Now release the pages and zero block aligned part of pages */
> 4519 truncate_pagecache_range(inode, start, end - 1);
4520 inode->i_mtime = inode->i_ctime = current_time(inode);
4521
4522 if (IS_DAX(inode))
4523 ret = dax_zeroinit_range(inode, offset, len,
4524 &ext4_iomap_report_ops);
4525 else
4526 ret = iomap_zeroout_range(inode, offset, len,
4527 &ext4_iomap_report_ops);
4528 if (ret == -ECANCELED)
4529 ret = -EOPNOTSUPP;
4530 up_write(&EXT4_I(inode)->i_mmap_sem);
4531 if (ret)
4532 goto out_mutex;
4533
4534 /*
4535 * In worst case we have to writeout two nonadjacent unwritten
4536 * blocks and update the inode
4537 */
4538 handle = ext4_journal_start(inode, EXT4_HT_MISC, 1);
4539 if (IS_ERR(handle)) {
4540 ret = PTR_ERR(handle);
4541 ext4_std_error(inode->i_sb, ret);
4542 goto out_mutex;
4543 }
4544
4545 inode->i_mtime = inode->i_ctime = current_time(inode);
4546 ret = ext4_mark_inode_dirty(handle, inode);
4547 if (unlikely(ret))
4548 goto out_handle;
4549 ext4_fc_track_range(handle, inode, offset >> inode->i_sb->s_blocksize_bits,
4550 (offset + len - 1) >> inode->i_sb->s_blocksize_bits);
4551 ext4_update_inode_fsync_trans(handle, inode, 1);
4552
4553 if (file->f_flags & O_SYNC)
4554 ext4_handle_sync(handle);
4555
4556 out_handle:
4557 ext4_journal_stop(handle);
4558 out_mutex:
4559 inode_unlock(inode);
4560 return ret;
4561 }
4562

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip