Re: [PATCH v3] fs/ext4: replace ternary operator with min()/max() and min_t()

From: kernel test robot
Date: Sat Aug 20 2022 - 18:51:32 EST


Hi Jiangshan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tytso-ext4/dev]
[also build test WARNING on linus/master v6.0-rc1 next-20220819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Jiangshan-Yi/fs-ext4-replace-ternary-operator-with-min-max-and-min_t/20220816-144454
base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
config: parisc-randconfig-s041-20220821 (https://download.01.org/0day-ci/archive/20220821/202208210652.VUSXxffI-lkp@xxxxxxxxx/config)
compiler: hppa-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/cdc8d157495f1a1cbf921569e2babf14446058cf
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jiangshan-Yi/fs-ext4-replace-ternary-operator-with-min-max-and-min_t/20220816-144454
git checkout cdc8d157495f1a1cbf921569e2babf14446058cf
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash fs/ext4/

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

sparse warnings: (new ones prefixed by >>)
>> fs/ext4/super.c:6907:26: sparse: sparse: incompatible types in comparison expression (different type sizes):
>> fs/ext4/super.c:6907:26: sparse: unsigned long *
>> fs/ext4/super.c:6907:26: sparse: unsigned int *
fs/ext4/super.c:992:6: sparse: sparse: context imbalance in '__ext4_grp_locked_error' - different lock contexts for basic block
fs/ext4/super.c:3266:9: sparse: sparse: context imbalance in 'ext4_check_descriptors' - different lock contexts for basic block

vim +6907 fs/ext4/super.c

6885
6886 /* Read data from quotafile - avoid pagecache and such because we cannot afford
6887 * acquiring the locks... As quota files are never truncated and quota code
6888 * itself serializes the operations (and no one else should touch the files)
6889 * we don't have to be afraid of races */
6890 static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data,
6891 size_t len, loff_t off)
6892 {
6893 struct inode *inode = sb_dqopt(sb)->files[type];
6894 ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb);
6895 int offset = off & (sb->s_blocksize - 1);
6896 int tocopy;
6897 size_t toread;
6898 struct buffer_head *bh;
6899 loff_t i_size = i_size_read(inode);
6900
6901 if (off > i_size)
6902 return 0;
6903 if (off+len > i_size)
6904 len = i_size-off;
6905 toread = len;
6906 while (toread > 0) {
> 6907 tocopy = min(sb->s_blocksize - offset, toread);
6908 bh = ext4_bread(NULL, inode, blk, 0);
6909 if (IS_ERR(bh))
6910 return PTR_ERR(bh);
6911 if (!bh) /* A hole? */
6912 memset(data, 0, tocopy);
6913 else
6914 memcpy(data, bh->b_data+offset, tocopy);
6915 brelse(bh);
6916 offset = 0;
6917 toread -= tocopy;
6918 data += tocopy;
6919 blk++;
6920 }
6921 return len;
6922 }
6923

--
0-DAY CI Kernel Test Service
https://01.org/lkp