All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Miklos Szeredi <mszeredi@redhat.com>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
	fuse-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [fuse:for-next 4/5] fs/fuse/inode.c:1524:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true
Date: Thu, 5 Aug 2021 00:16:34 +0800	[thread overview]
Message-ID: <202108050030.cxg6NKHX-lkp@intel.com> (raw)

[-- 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 --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [fuse:for-next 4/5] fs/fuse/inode.c:1524:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true
Date: Thu, 05 Aug 2021 00:16:34 +0800	[thread overview]
Message-ID: <202108050030.cxg6NKHX-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4257 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(a)lists.01.org

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

             reply	other threads:[~2021-08-04 16:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04 16:16 kernel test robot [this message]
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

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=202108050030.cxg6NKHX-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=fuse-devel@lists.sourceforge.net \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.