Skip to contentSkip to conversation

fs/ext4/extents.c:4713 ext4_do_fallocate() error: uninitialized symbol 'len_lblk'.

PATCH New Dan Carpenter 1 participant 1 message Sep 3, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 8/10 fs/ext4/extents.c:4713 ext4_do_fallocate() error: uninitialized symbol 'len_lblk'.

Hi Zhang,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree:   https://github.com/riteshharjani/linux [email protected]
head:   67214af3781b6c7fc5dcc524eb0826d638c39fdc
commit: f265e7a5e7cd772107b3876f91035bc7ab72013c [8/10] ext4: factor out ext4_do_fallocate()
config: riscv-randconfig-r072-20240901 (https://download.01.org/0day-ci/archive/20240903/[email protected]/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 6f682c26b04f0b349c4c473756cb8625b4f37c6d)

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 <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

smatch warnings:
fs/ext4/extents.c:4713 ext4_do_fallocate() error: uninitialized symbol 'len_lblk'.

vim +/len_lblk +4713 fs/ext4/extents.c

f265e7a5e7cd772 Zhang Yi      2024-08-30  4665  static long ext4_do_fallocate(struct file *file, loff_t offset,
f265e7a5e7cd772 Zhang Yi      2024-08-30  4666  			      loff_t len, int mode)
f265e7a5e7cd772 Zhang Yi      2024-08-30  4667  {
f265e7a5e7cd772 Zhang Yi      2024-08-30  4668  	struct inode *inode = file_inode(file);
f265e7a5e7cd772 Zhang Yi      2024-08-30  4669  	loff_t end = offset + len;
f265e7a5e7cd772 Zhang Yi      2024-08-30  4670  	loff_t new_size = 0;
f265e7a5e7cd772 Zhang Yi      2024-08-30  4671  	ext4_lblk_t start_lblk, len_lblk;
f265e7a5e7cd772 Zhang Yi      2024-08-30  4672  	int ret;
f265e7a5e7cd772 Zhang Yi      2024-08-30  4673  
f265e7a5e7cd772 Zhang Yi      2024-08-30  4674  	trace_ext4_fallocate_enter(inode, offset, len, mode);
f265e7a5e7cd772 Zhang Yi      2024-08-30  4675  
f265e7a5e7cd772 Zhang Yi      2024-08-30  4676  	inode_lock(inode);
f265e7a5e7cd772 Zhang Yi      2024-08-30  4677  
f265e7a5e7cd772 Zhang Yi      2024-08-30  4678  	/* We only support preallocation for extent-based files only. */
f265e7a5e7cd772 Zhang Yi      2024-08-30  4679  	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
f265e7a5e7cd772 Zhang Yi      2024-08-30  4680  		ret = -EOPNOTSUPP;
f265e7a5e7cd772 Zhang Yi      2024-08-30  4681  		goto out;

goto

f265e7a5e7cd772 Zhang Yi      2024-08-30  4682  	}
f265e7a5e7cd772 Zhang Yi      2024-08-30  4683  
f265e7a5e7cd772 Zhang Yi      2024-08-30  4684  	if (!(mode & FALLOC_FL_KEEP_SIZE) &&
f265e7a5e7cd772 Zhang Yi      2024-08-30  4685  	    (end > inode->i_size || end > EXT4_I(inode)->i_disksize)) {
f265e7a5e7cd772 Zhang Yi      2024-08-30  4686  		new_size = end;
f265e7a5e7cd772 Zhang Yi      2024-08-30  4687  		ret = inode_newsize_ok(inode, new_size);
f265e7a5e7cd772 Zhang Yi      2024-08-30  4688  		if (ret)
f265e7a5e7cd772 Zhang Yi      2024-08-30  4689  			goto out;

goto

f265e7a5e7cd772 Zhang Yi      2024-08-30  4690  	}
f265e7a5e7cd772 Zhang Yi      2024-08-30  4691  
f265e7a5e7cd772 Zhang Yi      2024-08-30  4692  	/* Wait all existing dio workers, newcomers will block on i_rwsem */
f265e7a5e7cd772 Zhang Yi      2024-08-30  4693  	inode_dio_wait(inode);
f265e7a5e7cd772 Zhang Yi      2024-08-30  4694  
f265e7a5e7cd772 Zhang Yi      2024-08-30  4695  	ret = file_modified(file);
f265e7a5e7cd772 Zhang Yi      2024-08-30  4696  	if (ret)
f265e7a5e7cd772 Zhang Yi      2024-08-30  4697  		goto out;

goto

f265e7a5e7cd772 Zhang Yi      2024-08-30  4698  
f265e7a5e7cd772 Zhang Yi      2024-08-30  4699  	start_lblk = offset >> inode->i_blkbits;
f265e7a5e7cd772 Zhang Yi      2024-08-30  4700  	len_lblk = EXT4_MAX_BLOCKS(len, offset, inode->i_blkbits);
f265e7a5e7cd772 Zhang Yi      2024-08-30  4701  
f265e7a5e7cd772 Zhang Yi      2024-08-30  4702  	ret = ext4_alloc_file_blocks(file, start_lblk, len_lblk, new_size,
f265e7a5e7cd772 Zhang Yi      2024-08-30  4703  				     EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT);
f265e7a5e7cd772 Zhang Yi      2024-08-30  4704  	if (ret)
f265e7a5e7cd772 Zhang Yi      2024-08-30  4705  		goto out;
f265e7a5e7cd772 Zhang Yi      2024-08-30  4706  
f265e7a5e7cd772 Zhang Yi      2024-08-30  4707  	if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) {
f265e7a5e7cd772 Zhang Yi      2024-08-30  4708  		ret = ext4_fc_commit(EXT4_SB(inode->i_sb)->s_journal,
f265e7a5e7cd772 Zhang Yi      2024-08-30  4709  					EXT4_I(inode)->i_sync_tid);
f265e7a5e7cd772 Zhang Yi      2024-08-30  4710  	}
f265e7a5e7cd772 Zhang Yi      2024-08-30  4711  out:
f265e7a5e7cd772 Zhang Yi      2024-08-30  4712  	inode_unlock(inode);
f265e7a5e7cd772 Zhang Yi      2024-08-30 @4713  	trace_ext4_fallocate_exit(inode, offset, len_lblk, ret);
                                                                                                 ^^^^^^^^

Uninitialized

f265e7a5e7cd772 Zhang Yi      2024-08-30  4714  	return ret;
f265e7a5e7cd772 Zhang Yi      2024-08-30  4715  }
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki