LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [fuse:for-next 4/5] fs/fuse/inode.c:1524:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true
@ 2021-08-04 16:16 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-08-04 16:16 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: clang-built-linux, kbuild-all, fuse-devel, linux-kernel

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next
head:   a55db824dd51d52f68811f8f82bcf0bbada69abf
commit: ff12b23145693516720dda015da7e51fcf236e4d [4/5] fuse: move fget() to fuse_get_tree()
config: x86_64-randconfig-a002-20210804 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 4f71f59bf3d9914188a11d0c41bedbb339d36ff5)
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://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/commit/?id=ff12b23145693516720dda015da7e51fcf236e4d
        git remote add fuse https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git
        git fetch --no-tags fuse for-next
        git checkout ff12b23145693516720dda015da7e51fcf236e4d
        # 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/fuse/inode.c:1524:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
           if ((ctx->file->f_op != &fuse_dev_operations) ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/inode.c:1558:9: note: uninitialized use occurs here
           return err;
                  ^~~
   fs/fuse/inode.c:1524:2: note: remove the 'if' if its condition is always false
           if ((ctx->file->f_op != &fuse_dev_operations) ||
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/fuse/inode.c:1524:6: warning: variable 'err' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized]
           if ((ctx->file->f_op != &fuse_dev_operations) ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/inode.c:1558:9: note: uninitialized use occurs here
           return err;
                  ^~~
   fs/fuse/inode.c:1524:6: note: remove the '||' if its condition is always false
           if ((ctx->file->f_op != &fuse_dev_operations) ||
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/fuse/inode.c:1512:9: note: initialize the variable 'err' to silence this warning
           int err;
                  ^
                   = 0
   2 warnings generated.


vim +1524 fs/fuse/inode.c

  1508	
  1509	static int fuse_fill_super(struct super_block *sb, struct fs_context *fsc)
  1510	{
  1511		struct fuse_fs_context *ctx = fsc->fs_private;
  1512		int err;
  1513		struct fuse_conn *fc;
  1514		struct fuse_mount *fm;
  1515	
  1516		if (!ctx->file || !ctx->rootmode_present ||
  1517		    !ctx->user_id_present || !ctx->group_id_present)
  1518			return -EINVAL;
  1519	
  1520		/*
  1521		 * Require mount to happen from the same user namespace which
  1522		 * opened /dev/fuse to prevent potential attacks.
  1523		 */
> 1524		if ((ctx->file->f_op != &fuse_dev_operations) ||
  1525		    (ctx->file->f_cred->user_ns != sb->s_user_ns))
  1526			goto err;
  1527		ctx->fudptr = &ctx->file->private_data;
  1528	
  1529		fc = kmalloc(sizeof(*fc), GFP_KERNEL);
  1530		err = -ENOMEM;
  1531		if (!fc)
  1532			goto err;
  1533	
  1534		fm = kzalloc(sizeof(*fm), GFP_KERNEL);
  1535		if (!fm) {
  1536			kfree(fc);
  1537			goto err;
  1538		}
  1539	
  1540		fuse_conn_init(fc, fm, sb->s_user_ns, &fuse_dev_fiq_ops, NULL);
  1541		fc->release = fuse_free_conn;
  1542	
  1543		sb->s_fs_info = fm;
  1544	
  1545		err = fuse_fill_super_common(sb, ctx);
  1546		if (err)
  1547			goto err_put_conn;
  1548		/* file->private_data shall be visible on all CPUs after this */
  1549		smp_mb();
  1550		fuse_send_init(get_fuse_mount_super(sb));
  1551		return 0;
  1552	
  1553	 err_put_conn:
  1554		fuse_conn_put(fc);
  1555		kfree(fm);
  1556		sb->s_fs_info = NULL;
  1557	 err:
  1558		return err;
  1559	}
  1560	

---
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: 27866 bytes --]

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

only message in thread, other threads:[~2021-08-04 16:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 16:16 [fuse:for-next 4/5] fs/fuse/inode.c:1524:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true 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;
as well as URLs for NNTP newsgroup(s).