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]
Date:   Thu, 3 Mar 2022 01:14:20 +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/fscache-next 36/39]
 fs/netfs/io.c:630:2: warning: variable 'ret' is used uninitialized whenever
 'if' condition is false

Hi David,

First bad commit (maybe != root cause):

tree:   https://github.com/ammarfaizi2/linux-block dhowells/linux-fs/fscache-next
head:   78e12b114b9c804d4b1eef16b6df1112cde6a960
commit: ad9e5adb388f358027a51032b3944913d98f7866 [36/39] netfs: Rename rename read_helper.c to io.c
config: hexagon-buildonly-randconfig-r006-20220302 (https://download.01.org/0day-ci/archive/20220303/202203030120.FpZOVtN6-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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/ad9e5adb388f358027a51032b3944913d98f7866
        git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
        git fetch --no-tags ammarfaizi2-block dhowells/linux-fs/fscache-next
        git checkout ad9e5adb388f358027a51032b3944913d98f7866
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash fs/netfs/

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

All warnings (new ones prefixed by >>):

>> fs/netfs/io.c:630:2: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (sync) {
           ^~~~~~~~~
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/netfs/io.c:655:9: note: uninitialized use occurs here
           return ret;
                  ^~~
   fs/netfs/io.c:630:2: note: remove the 'if' if its condition is always true
           if (sync) {
           ^~~~~~~~~~
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   fs/netfs/io.c:604:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +630 fs/netfs/io.c

3d3c95046742e4 fs/netfs/read_helper.c David Howells 2020-05-13  595  
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  596  /*
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  597   * Begin the process of reading in a chunk of data, where that data may be
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  598   * stitched together from multiple sources, including multiple servers and the
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  599   * local cache.
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  600   */
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  601  int netfs_begin_read(struct netfs_io_request *rreq, bool sync)
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  602  {
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  603  	unsigned int debug_index = 0;
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  604  	int ret;
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  605  
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  606  	_enter("R=%x %llx-%llx",
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  607  	       rreq->debug_id, rreq->start, rreq->start + rreq->len - 1);
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  608  
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  609  	if (rreq->len == 0) {
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  610  		pr_err("Zero-sized read [R=%x]\n", rreq->debug_id);
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  611  		netfs_put_request(rreq, false, netfs_rreq_trace_put_zero_len);
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  612  		return -EIO;
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  613  	}
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  614  
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  615  	rreq->work.func = netfs_rreq_work;
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  616  
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  617  	if (sync)
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  618  		netfs_get_request(rreq, netfs_rreq_trace_get_hold);
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  619  
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  620  	/* Chop the read into slices according to what the cache and the netfs
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  621  	 * want and submit each one.
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  622  	 */
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  623  	atomic_set(&rreq->nr_outstanding, 1);
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  624  	do {
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  625  		if (!netfs_rreq_submit_slice(rreq, &debug_index))
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  626  			break;
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  627  
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  628  	} while (rreq->submitted < rreq->len);
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02  629  
c19a5d31b470e0 fs/netfs/read_helper.c David Howells 2022-03-02 @630  	if (sync) {

:::::: The code at line 630 was first introduced by commit
:::::: c19a5d31b470e0a7dea07a71bb7b98a916b449e9 netfs: Add a function to consolidate beginning a read

:::::: TO: David Howells <dhowells@...hat.com>
:::::: CC: David Howells <dhowells@...hat.com>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ