Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [jlayton:fuse 2/3] fs/fuse/control.c:54:6: warning: variable 'value' is used uninitialized whenever 'if' condition is false
@ 2025-02-01  4:24 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-02-01  4:24 UTC (permalink / raw)
  To: Jeff Layton; +Cc: llvm, oe-kbuild-all

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-02-01  4:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-01  4:24 [jlayton:fuse 2/3] fs/fuse/control.c:54:6: warning: variable 'value' is used uninitialized whenever 'if' condition is false kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox