Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [jlayton:fuse 2/3] fs/fuse/control.c:54:6: warning: variable 'value' is used uninitialized whenever 'if' condition is false
Date: Sat, 1 Feb 2025 12:24:28 +0800	[thread overview]
Message-ID: <202502011249.NNx7K6U5-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git fuse
head:   dab78745e20591bc228e71dcdea06da75da7bbf8
commit: 0eeb0bede371cbfe42ef9f2605da708ddd1b1ffd [2/3] fuse: don't set file->private_data in fuse_conn_waiting_read
config: x86_64-buildonly-randconfig-005-20250201 (https://download.01.org/0day-ci/archive/20250201/202502011249.NNx7K6U5-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250201/202502011249.NNx7K6U5-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502011249.NNx7K6U5-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/fuse/control.c:54:6: warning: variable 'value' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
      54 |         if (!*ppos) {
         |             ^~~~~~
   fs/fuse/control.c:62:30: note: uninitialized use occurs here
      62 |         size = sprintf(tmp, "%d\n", value);
         |                                     ^~~~~
   fs/fuse/control.c:54:2: note: remove the 'if' if its condition is always true
      54 |         if (!*ppos) {
         |         ^~~~~~~~~~~
   fs/fuse/control.c:52:11: note: initialize the variable 'value' to silence this warning
      52 |         int value;
         |                  ^
         |                   = 0
   1 warning generated.


vim +54 fs/fuse/control.c

bafa96541b250a Miklos Szeredi 2006-06-25  46  
bafa96541b250a Miklos Szeredi 2006-06-25  47  static ssize_t fuse_conn_waiting_read(struct file *file, char __user *buf,
bafa96541b250a Miklos Szeredi 2006-06-25  48  				      size_t len, loff_t *ppos)
bafa96541b250a Miklos Szeredi 2006-06-25  49  {
bafa96541b250a Miklos Szeredi 2006-06-25  50  	char tmp[32];
bafa96541b250a Miklos Szeredi 2006-06-25  51  	size_t size;
0eeb0bede371cb Jeff Layton    2025-01-31  52  	int value;
bafa96541b250a Miklos Szeredi 2006-06-25  53  
bafa96541b250a Miklos Szeredi 2006-06-25 @54  	if (!*ppos) {
bafa96541b250a Miklos Szeredi 2006-06-25  55  		struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
bafa96541b250a Miklos Szeredi 2006-06-25  56  		if (!fc)
bafa96541b250a Miklos Szeredi 2006-06-25  57  			return 0;
bafa96541b250a Miklos Szeredi 2006-06-25  58  
1729a16c2c92bb Miklos Szeredi 2008-11-26  59  		value = atomic_read(&fc->num_waiting);
bafa96541b250a Miklos Szeredi 2006-06-25  60  		fuse_conn_put(fc);
bafa96541b250a Miklos Szeredi 2006-06-25  61  	}
0eeb0bede371cb Jeff Layton    2025-01-31  62  	size = sprintf(tmp, "%d\n", value);
bafa96541b250a Miklos Szeredi 2006-06-25  63  	return simple_read_from_buffer(buf, len, ppos, tmp, size);
bafa96541b250a Miklos Szeredi 2006-06-25  64  }
bafa96541b250a Miklos Szeredi 2006-06-25  65  

:::::: The code at line 54 was first introduced by commit
:::::: bafa96541b250a7051e3fbc5de6e8369daf8ffec [PATCH] fuse: add control filesystem

:::::: TO: Miklos Szeredi <miklos@szeredi.hu>
:::::: CC: Linus Torvalds <torvalds@g5.osdl.org>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2025-02-01  4:25 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=202502011249.NNx7K6U5-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jlayton@kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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