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>] [day] [month] [year] [list]
Message-ID: <202206302322.xyUBUa80-lkp@intel.com>
Date:   Fri, 1 Jul 2022 00:01:46 +0800
From:   kernel test robot <lkp@...el.com>
To:     David Howells <dhowells@...hat.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>,
        linux-kernel@...r.kernel.org
Subject: [ammarfaizi2-block:dhowells/linux-fs/netfs-linked-list 55/55]
 fs/netfs/truncate.c:191:39: warning: format specifies type 'unsigned long'
 but the argument has type 'size_t' (aka 'unsigned int')

tree:   https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/netfs-linked-list
head:   e0aed6defb4fe6c570e77e8fd8d899651b40366e
commit: e0aed6defb4fe6c570e77e8fd8d899651b40366e [55/55] netfs: Implement truncation
config: i386-randconfig-a002 (https://download.01.org/0day-ci/archive/20220630/202206302322.xyUBUa80-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a774ba7f60d1fef403b5507b1b1a7475d3684d71)
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
        # https://github.com/ammarfaizi2/linux-block/commit/e0aed6defb4fe6c570e77e8fd8d899651b40366e
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/netfs-linked-list
        git checkout e0aed6defb4fe6c570e77e8fd8d899651b40366e
        # 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=i386 SHELL=/bin/bash fs/netfs/

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/netfs/truncate.c:191:39: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                          from, to, folio->index, fto, seg, offset);
                                                       ^~~
   fs/netfs/internal.h:282:43: note: expanded from macro 'kdebug'
   #define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__)
                                      ~~~    ^~~~~~~~~~~
   fs/netfs/internal.h:278:46: note: expanded from macro 'dbgprintk'
           printk("[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__)
                             ~~~                       ^~~~~~~~~~~
   include/linux/printk.h:464:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                       ~~~    ^~~~~~~~~~~
   include/linux/printk.h:436:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                           ~~~~    ^~~~~~~~~~~
   fs/netfs/truncate.c:191:44: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
                          from, to, folio->index, fto, seg, offset);
                                                            ^~~~~~
   fs/netfs/internal.h:282:43: note: expanded from macro 'kdebug'
   #define kdebug(FMT, ...) dbgprintk(FMT, ##__VA_ARGS__)
                                      ~~~    ^~~~~~~~~~~
   fs/netfs/internal.h:278:46: note: expanded from macro 'dbgprintk'
           printk("[%-6.6s] "FMT"\n", current->comm, ##__VA_ARGS__)
                             ~~~                       ^~~~~~~~~~~
   include/linux/printk.h:464:60: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                                                       ~~~    ^~~~~~~~~~~
   include/linux/printk.h:436:19: note: expanded from macro 'printk_index_wrap'
                   _p_func(_fmt, ##__VA_ARGS__);                           \
                           ~~~~    ^~~~~~~~~~~
   fs/netfs/truncate.c:202:18: warning: variable 'to' is uninitialized when used here [-Wuninitialized]
           } while (from < to);
                           ^~
   fs/netfs/truncate.c:149:18: note: initialize the variable 'to' to silence this warning
           pgoff_t from, to, fto;
                           ^
                            = 0
   fs/netfs/truncate.c:170:6: warning: variable 'from' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (ret < 0)
               ^~~~~~~
   fs/netfs/truncate.c:176:45: note: uninitialized use occurs here
                   folio = read_mapping_folio(treq->mapping, from, NULL);
                                                             ^~~~
   fs/netfs/truncate.c:170:2: note: remove the 'if' if its condition is always true
           if (ret < 0)
           ^~~~~~~~~~~~
   fs/netfs/truncate.c:149:14: note: initialize the variable 'from' to silence this warning
           pgoff_t from, to, fto;
                       ^
                        = 0
   4 warnings generated.


vim +191 fs/netfs/truncate.c

   133	
   134	/*
   135	 * Set up a pair of buffers with which we can perform an RMW cycle to
   136	 * reconstitute the block containing the EOF marker.  One buffer will hold the
   137	 * proposed modification in unencrypted form, the other will hold the
   138	 * encrypted/compressed data.
   139	 *
   140	 * We don't want to make our proposed changes to the pagecache yet as we would
   141	 * have to back them out if an error occurs.
   142	 */
   143	static int netfs_prepare_trunc_buffers(struct netfs_io_request *treq)
   144	{
   145		struct netfs_inode *ctx = netfs_inode(treq->inode);
   146		struct iov_iter iter;
   147		struct folio *folio;
   148		unsigned long long base;
   149		pgoff_t from, to, fto;
   150		size_t offset, seg;
   151		size_t bsize = max_t(size_t, 1UL << ctx->min_bshift, PAGE_SIZE);
   152		int ret;
   153	
   154		/* We want to hold the entire replacement block, but we round that out
   155		 * to a multiple of pages.
   156		 */
   157		base = round_down(treq->trunc_i_size, bsize);
   158		treq->start	= base;
   159		treq->len	= bsize;
   160		treq->first	= base / PAGE_SIZE;
   161		treq->last	= (base + bsize + 1) / PAGE_SIZE;
   162	
   163		ret = netfs_add_folios_to_buffer(&treq->buffer, treq->first, treq->last,
   164						 GFP_KERNEL);
   165		if (ret < 0)
   166			return ret;
   167	
   168		ret = netfs_add_folios_to_buffer(&treq->bounce, treq->first, treq->last,
   169						 GFP_KERNEL);
   170		if (ret < 0)
   171			return ret;
   172	
   173		/* We need to fill the buffer. */
   174		iov_iter_xarray(&iter, READ, &treq->buffer, base, base + bsize);
   175		do {
   176			folio = read_mapping_folio(treq->mapping, from, NULL);
   177			if (IS_ERR(folio))
   178				return PTR_ERR(folio);
   179			if (folio->index > from ||
   180			    folio->index + folio_nr_pages(folio) <= folio->index) {
   181				folio_put(folio);
   182				kleave("-EIO [unexpected folio %lx != %lx]", folio->index, from);
   183				return -EIO;
   184			}
   185	
   186			offset = (from - folio->index);
   187			fto = folio->index + folio_nr_pages(folio) - 1;
   188			seg = min(to, fto);
   189			seg = (seg - from) + 1;
   190			kdebug("buf=%lx-%lx fol=%lx-%lx s=%lx@%lx",
 > 191			       from, to, folio->index, fto, seg, offset);
   192			if (copy_folio_to_iter(folio, offset * PAGE_SIZE, seg * PAGE_SIZE, &iter)) {
   193				folio_put(folio);
   194				kleave(" = -EIO [copy failure]");
   195				return -EIO;
   196			}
   197	
   198			/* We keep the refs to discard later - we don't want read
   199			 * interfering with what we're up to.
   200			 */
   201			from = fto;
   202		} while (from < to);
   203	
   204		/* Lock the folios and clear the uptodate flag.  Read must wait. */
   205	
   206		/* Clear the region after the new EOF */
   207		iov_iter_xarray(&iter, READ, &treq->buffer, base, base + bsize);
   208		iov_iter_advance(&iter, treq->trunc_i_size - treq->start);
   209		iov_iter_zero(iov_iter_count(&iter), &iter);
   210		return 0;
   211	}
   212	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ