fs/ext4/fast_commit.c:1774:50: sparse: sparse: incorrect type in argument 2 (different base types)

From: kernel test robot
Date: Mon Jan 24 2022 - 11:25:01 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: dd81e1c7d5fb126e5fbc5c9e334d7b3ec29a16a0
commit: 0b5b5a62b945a141e64011b2f90ee7e46f14be98 ext4: use ext4_ext_remove_space() for fast commit replay delete range
date: 2 weeks ago
config: csky-randconfig-s032-20220120 (https://download.01.org/0day-ci/archive/20220125/202201250031.GhpANyOP-lkp@xxxxxxxxx/config)
compiler: csky-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b5b5a62b945a141e64011b2f90ee7e46f14be98
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 0b5b5a62b945a141e64011b2f90ee7e46f14be98
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=csky SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
>> fs/ext4/fast_commit.c:1774:50: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] start @@ got restricted __le32 [addressable] [usertype] fc_lblk @@
fs/ext4/fast_commit.c:1774:50: sparse: expected unsigned int [usertype] start
fs/ext4/fast_commit.c:1774:50: sparse: got restricted __le32 [addressable] [usertype] fc_lblk
>> fs/ext4/fast_commit.c:1775:39: sparse: sparse: restricted __le32 degrades to integer
fs/ext4/fast_commit.c:1775:56: sparse: sparse: restricted __le32 degrades to integer

vim +1774 fs/ext4/fast_commit.c

1724
1725 /* Replay DEL_RANGE tag */
1726 static int
1727 ext4_fc_replay_del_range(struct super_block *sb, struct ext4_fc_tl *tl,
1728 u8 *val)
1729 {
1730 struct inode *inode;
1731 struct ext4_fc_del_range lrange;
1732 struct ext4_map_blocks map;
1733 ext4_lblk_t cur, remaining;
1734 int ret;
1735
1736 memcpy(&lrange, val, sizeof(lrange));
1737 cur = le32_to_cpu(lrange.fc_lblk);
1738 remaining = le32_to_cpu(lrange.fc_len);
1739
1740 trace_ext4_fc_replay(sb, EXT4_FC_TAG_DEL_RANGE,
1741 le32_to_cpu(lrange.fc_ino), cur, remaining);
1742
1743 inode = ext4_iget(sb, le32_to_cpu(lrange.fc_ino), EXT4_IGET_NORMAL);
1744 if (IS_ERR(inode)) {
1745 jbd_debug(1, "Inode %d not found", le32_to_cpu(lrange.fc_ino));
1746 return 0;
1747 }
1748
1749 ret = ext4_fc_record_modified_inode(sb, inode->i_ino);
1750
1751 jbd_debug(1, "DEL_RANGE, inode %ld, lblk %d, len %d\n",
1752 inode->i_ino, le32_to_cpu(lrange.fc_lblk),
1753 le32_to_cpu(lrange.fc_len));
1754 while (remaining > 0) {
1755 map.m_lblk = cur;
1756 map.m_len = remaining;
1757
1758 ret = ext4_map_blocks(NULL, inode, &map, 0);
1759 if (ret < 0) {
1760 iput(inode);
1761 return 0;
1762 }
1763 if (ret > 0) {
1764 remaining -= ret;
1765 cur += ret;
1766 ext4_mb_mark_bb(inode->i_sb, map.m_pblk, map.m_len, 0);
1767 } else {
1768 remaining -= map.m_len;
1769 cur += map.m_len;
1770 }
1771 }
1772
1773 down_write(&EXT4_I(inode)->i_data_sem);
> 1774 ret = ext4_ext_remove_space(inode, lrange.fc_lblk,
> 1775 lrange.fc_lblk + lrange.fc_len - 1);
1776 up_write(&EXT4_I(inode)->i_data_sem);
1777 if (ret) {
1778 iput(inode);
1779 return 0;
1780 }
1781 ext4_ext_replay_shrink_inode(inode,
1782 i_size_read(inode) >> sb->s_blocksize_bits);
1783 ext4_mark_inode_dirty(NULL, inode);
1784 iput(inode);
1785
1786 return 0;
1787 }
1788

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