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:   Fri, 23 Jul 2021 12:23:22 +0800
From:   kernel test robot <lkp@...el.com>
To:     Bart Van Assche <bvanassche@....org>
Cc:     clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [bvanassche:configfs 1/3] fs/configfs/file.c:234:6: warning:
 variable 'written' is used uninitialized whenever 'if' condition is false

tree:   https://github.com/bvanassche/linux configfs
head:   d039a111183e8b3aafba81b0bbc4bf620e79b818
commit: 314a1ff31221fcdf3d62e0142b4212d6410e4173 [1/3] configfs: Improve writing at a non-zero offset
config: x86_64-randconfig-r031-20210723 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9625ca5b602616b2f5584e8a49ba93c52c141e40)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/bvanassche/linux/commit/314a1ff31221fcdf3d62e0142b4212d6410e4173
        git remote add bvanassche https://github.com/bvanassche/linux
        git fetch --no-tags bvanassche configfs
        git checkout 314a1ff31221fcdf3d62e0142b4212d6410e4173
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

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/configfs/file.c:234:6: warning: variable 'written' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (len > 0)
               ^~~~~~~
   fs/configfs/file.c:236:6: note: uninitialized use occurs here
           if (written > 0)
               ^~~~~~~
   fs/configfs/file.c:234:2: note: remove the 'if' if its condition is always true
           if (len > 0)
           ^~~~~~~~~~~~
   fs/configfs/file.c:230:22: note: initialize the variable 'written' to silence this warning
           ssize_t len, written;
                               ^
                                = 0
   1 warning generated.


vim +234 fs/configfs/file.c

7063fbf2261194 Joel Becker       2005-12-15  217  
7063fbf2261194 Joel Becker       2005-12-15  218  
44b9a000df5cc1 Christoph Hellwig 2021-05-25  219  /*
7063fbf2261194 Joel Becker       2005-12-15  220   * There is no easy way for us to know if userspace is only doing a partial
44b9a000df5cc1 Christoph Hellwig 2021-05-25  221   * write, so we don't support them. We expect the entire buffer to come on the
44b9a000df5cc1 Christoph Hellwig 2021-05-25  222   * first write.
44b9a000df5cc1 Christoph Hellwig 2021-05-25  223   * Hint: if you're writing a value, first read the file, modify only the value
44b9a000df5cc1 Christoph Hellwig 2021-05-25  224   * you're changing, then write entire buffer back.
7063fbf2261194 Joel Becker       2005-12-15  225   */
7fe1e79b59ba02 Bart Van Assche   2021-05-25  226  static ssize_t configfs_write_iter(struct kiocb *iocb, struct iov_iter *from)
7063fbf2261194 Joel Becker       2005-12-15  227  {
7fe1e79b59ba02 Bart Van Assche   2021-05-25  228  	struct file *file = iocb->ki_filp;
7063fbf2261194 Joel Becker       2005-12-15  229  	struct configfs_buffer *buffer = file->private_data;
314a1ff31221fc Bart Van Assche   2021-07-22  230  	ssize_t len, written;
7063fbf2261194 Joel Becker       2005-12-15  231  
6d748924b753d6 Johannes Berg     2007-06-22  232  	mutex_lock(&buffer->mutex);
420405ecde061f Bart Van Assche   2021-07-13  233  	len = fill_write_buffer(buffer, iocb->ki_pos, from);
3d0f89bb169482 Joel Becker       2006-01-25 @234  	if (len > 0)
314a1ff31221fc Bart Van Assche   2021-07-22  235  		written = flush_write_buffer(file, buffer, iocb->ki_pos + len);
314a1ff31221fc Bart Van Assche   2021-07-22  236  	if (written > 0)
7fe1e79b59ba02 Bart Van Assche   2021-05-25  237  		iocb->ki_pos += len;
6d748924b753d6 Johannes Berg     2007-06-22  238  	mutex_unlock(&buffer->mutex);
3d0f89bb169482 Joel Becker       2006-01-25  239  	return len;
7063fbf2261194 Joel Becker       2005-12-15  240  }
7063fbf2261194 Joel Becker       2005-12-15  241  

:::::: The code at line 234 was first introduced by commit
:::::: 3d0f89bb169482d26d5aa4e82e763077e7e9bc4d configfs: Add permission and ownership to configfs objects.

:::::: TO: Joel Becker <joel.becker@...cle.com>
:::::: CC: Mark Fasheh <mark.fasheh@...cle.com>

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

Download attachment ".config.gz" of type "application/gzip" (36514 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ