lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202208161804.LDES1sZt-lkp@intel.com>
Date:   Tue, 16 Aug 2022 18:10:56 +0800
From:   kernel test robot <lkp@...el.com>
To:     Jiangshan Yi <13667453960@....com>, tytso@....edu,
        adilger.kernel@...ger.ca
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org, lczerner@...hat.com,
        linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jiangshan Yi <yijiangshan@...inos.cn>
Subject: Re: [PATCH v3] fs/ext4: replace ternary operator with min()/max()
 and min_t()

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-20220816]
[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: arm-randconfig-r034-20220815
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec)
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 arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # 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=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash fs/ext4/

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

All warnings (new ones prefixed by >>):

>> fs/ext4/super.c:6907:12: warning: comparison of distinct pointer types ('typeof (sb->s_blocksize - offset) *' (aka 'unsigned long *') and 'typeof (toread) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
                   tocopy = min(sb->s_blocksize - offset, toread);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:45:19: note: expanded from macro 'min'
   #define min(x, y)       __careful_cmp(x, y, <)
                           ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
           __builtin_choose_expr(__safe_cmp(x, y), \
                                 ^~~~~~~~~~~~~~~~
   include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
                   (__typecheck(x, y) && __no_side_effects(x, y))
                    ^~~~~~~~~~~~~~~~~
   include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
           (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
                      ~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~
   1 warning generated.


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

View attachment "config" of type "text/plain" (166496 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ