mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org
Subject: [bvanassche:configfs 1/3] fs/configfs/file.c:234:6: warning: variable 'written' is used uninitialized whenever 'if' condition is false
Date: Fri, 23 Jul 2021 12:23:22 +0800	[thread overview]
Message-ID: <202107231210.QXoeYkhk-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4295 bytes --]

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@intel.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@oracle.com>
:::::: CC: Mark Fasheh <mark.fasheh@oracle.com>

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36514 bytes --]

                 reply	other threads:[~2021-07-23  4:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202107231210.QXoeYkhk-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=bvanassche@acm.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®