All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [djwong-xfs:reserve-rt-metadata-space 129/196] fs/xfs/scrub/repair.c:1788 xrep_setup_orphanage() error: uninitialized symbol 'error'.
Date: Tue, 19 Jan 2021 11:39:01 +0300	[thread overview]
Message-ID: <20210119083900.GH2696@kadam> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git reserve-rt-metadata-space
head:   51f17deded84ae5863d2220a0a7c152ef4a8bbb2
commit: 02ccf9a104716ff589dad55fcaf22d97d165e1e7 [129/196] xfs: move orphan files to the orphanage
config: i386-randconfig-m021-20210115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
fs/xfs/scrub/repair.c:1788 xrep_setup_orphanage() error: uninitialized symbol 'error'.

vim +/error +1788 fs/xfs/scrub/repair.c

02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1715  int
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1716  xrep_setup_orphanage(
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1717  	struct xfs_scrub	*sc)
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1718  {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1719  	struct xfs_mount	*mp = sc->mp;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1720  	struct dentry		*root_dentry, *orphanage_dentry;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1721  	struct inode		*root_inode = VFS_I(sc->mp->m_rootip);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1722  	struct inode		*orphanage_inode;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1723  	int			error;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1724  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1725  	if (XFS_FORCED_SHUTDOWN(mp))
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1726  		return -EIO;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1727  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1728  	ASSERT(sc->tp == NULL);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1729  	ASSERT(sc->orphanage == NULL);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1730  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1731  	/* Find the dentry for the root directory... */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1732  	root_dentry = d_find_alias(root_inode);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1733  	if (!root_dentry) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1734  		error = -EFSCORRUPTED;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1735  		goto out;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1736  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1737  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1738  	/* ...which is a directory, right? */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1739  	if (!d_is_dir(root_dentry)) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1740  		error = -EFSCORRUPTED;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1741  		goto out_dput_root;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1742  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1743  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1744  	/* Try to find the orphanage directory. */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1745  	inode_lock_nested(root_inode, I_MUTEX_PARENT);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1746  	orphanage_dentry = lookup_one_len(ORPHANAGE, root_dentry,
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1747  			strlen(ORPHANAGE));
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1748  	if (IS_ERR(orphanage_dentry)) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1749  		error = PTR_ERR(orphanage_dentry);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1750  		goto out_unlock_root;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1751  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1752  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1753  	/* Nothing found?  Call mkdir to create the orphanage. */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1754  	if (d_really_is_negative(orphanage_dentry)) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1755  		error = vfs_mkdir(root_inode, orphanage_dentry, 0755);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1756  		if (error)
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1757  			goto out_dput_orphanage;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1758  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1759  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1760  	/* Not a directory? Bail out. */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1761  	if (!d_is_dir(orphanage_dentry)) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1762  		error = -ENOTDIR;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1763  		goto out_dput_orphanage;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1764  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1765  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1766  	/*
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1767  	 * Grab a reference to the orphanage.  This /should/ succeed since
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1768  	 * we hold the root directory locked and therefore nobody can delete
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1769  	 * the orphanage.
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1770  	 */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1771  	orphanage_inode = igrab(d_inode(orphanage_dentry));
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1772  	if (!orphanage_inode) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1773  		error = -ENOENT;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1774  		goto out_dput_orphanage;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1775  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1776  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1777  	/* Stash the reference for later and bail out. */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1778  	sc->orphanage = XFS_I(orphanage_inode);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1779  	sc->orphanage_ilock_flags = 0;

error not initialized on the success path.

02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1780  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1781  out_dput_orphanage:
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1782  	dput(orphanage_dentry);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1783  out_unlock_root:
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1784  	inode_unlock(VFS_I(sc->mp->m_rootip));
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1785  out_dput_root:
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1786  	dput(root_dentry);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1787  out:
02ccf9a104716ff5 Darrick J. Wong 2021-01-05 @1788  	return error;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1789  }

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [djwong-xfs:reserve-rt-metadata-space 129/196] fs/xfs/scrub/repair.c:1788 xrep_setup_orphanage() error: uninitialized symbol 'error'.
Date: Tue, 19 Jan 2021 11:39:01 +0300	[thread overview]
Message-ID: <20210119083900.GH2696@kadam> (raw)

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git reserve-rt-metadata-space
head:   51f17deded84ae5863d2220a0a7c152ef4a8bbb2
commit: 02ccf9a104716ff589dad55fcaf22d97d165e1e7 [129/196] xfs: move orphan files to the orphanage
config: i386-randconfig-m021-20210115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
fs/xfs/scrub/repair.c:1788 xrep_setup_orphanage() error: uninitialized symbol 'error'.

vim +/error +1788 fs/xfs/scrub/repair.c

02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1715  int
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1716  xrep_setup_orphanage(
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1717  	struct xfs_scrub	*sc)
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1718  {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1719  	struct xfs_mount	*mp = sc->mp;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1720  	struct dentry		*root_dentry, *orphanage_dentry;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1721  	struct inode		*root_inode = VFS_I(sc->mp->m_rootip);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1722  	struct inode		*orphanage_inode;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1723  	int			error;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1724  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1725  	if (XFS_FORCED_SHUTDOWN(mp))
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1726  		return -EIO;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1727  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1728  	ASSERT(sc->tp == NULL);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1729  	ASSERT(sc->orphanage == NULL);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1730  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1731  	/* Find the dentry for the root directory... */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1732  	root_dentry = d_find_alias(root_inode);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1733  	if (!root_dentry) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1734  		error = -EFSCORRUPTED;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1735  		goto out;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1736  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1737  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1738  	/* ...which is a directory, right? */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1739  	if (!d_is_dir(root_dentry)) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1740  		error = -EFSCORRUPTED;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1741  		goto out_dput_root;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1742  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1743  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1744  	/* Try to find the orphanage directory. */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1745  	inode_lock_nested(root_inode, I_MUTEX_PARENT);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1746  	orphanage_dentry = lookup_one_len(ORPHANAGE, root_dentry,
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1747  			strlen(ORPHANAGE));
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1748  	if (IS_ERR(orphanage_dentry)) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1749  		error = PTR_ERR(orphanage_dentry);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1750  		goto out_unlock_root;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1751  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1752  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1753  	/* Nothing found?  Call mkdir to create the orphanage. */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1754  	if (d_really_is_negative(orphanage_dentry)) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1755  		error = vfs_mkdir(root_inode, orphanage_dentry, 0755);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1756  		if (error)
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1757  			goto out_dput_orphanage;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1758  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1759  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1760  	/* Not a directory? Bail out. */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1761  	if (!d_is_dir(orphanage_dentry)) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1762  		error = -ENOTDIR;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1763  		goto out_dput_orphanage;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1764  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1765  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1766  	/*
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1767  	 * Grab a reference to the orphanage.  This /should/ succeed since
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1768  	 * we hold the root directory locked and therefore nobody can delete
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1769  	 * the orphanage.
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1770  	 */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1771  	orphanage_inode = igrab(d_inode(orphanage_dentry));
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1772  	if (!orphanage_inode) {
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1773  		error = -ENOENT;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1774  		goto out_dput_orphanage;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1775  	}
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1776  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1777  	/* Stash the reference for later and bail out. */
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1778  	sc->orphanage = XFS_I(orphanage_inode);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1779  	sc->orphanage_ilock_flags = 0;

error not initialized on the success path.

02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1780  
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1781  out_dput_orphanage:
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1782  	dput(orphanage_dentry);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1783  out_unlock_root:
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1784  	inode_unlock(VFS_I(sc->mp->m_rootip));
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1785  out_dput_root:
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1786  	dput(root_dentry);
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1787  out:
02ccf9a104716ff5 Darrick J. Wong 2021-01-05 @1788  	return error;
02ccf9a104716ff5 Darrick J. Wong 2021-01-05  1789  }

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

             reply	other threads:[~2021-01-19  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-19  8:39 Dan Carpenter [this message]
2021-01-19  8:39 ` [djwong-xfs:reserve-rt-metadata-space 129/196] fs/xfs/scrub/repair.c:1788 xrep_setup_orphanage() error: uninitialized symbol 'error' Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2021-01-16  8:07 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=20210119083900.GH2696@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.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 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.