All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [allisonhenderson-xfs-work:delayed_attrs_v26_extended 28/30] fs/xfs/xfs_ioctl.c:1753 xfs_ioc_get_parent_pointer() warn: maybe return -EFAULT instead of the bytes remaining?
Date: Tue, 25 Jan 2022 08:26:31 +0800	[thread overview]
Message-ID: <202201250715.EbP8D1XT-lkp@intel.com> (raw)

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Allison Henderson <allison.henderson@oracle.com>

tree:   https://github.com/allisonhenderson/xfs_work.git delayed_attrs_v26_extended
head:   19459f5cfa422b0a6a9cd3898892e43ecb49f8f3
commit: 38f492d29e0c25066170d87572b7ade7bf2af72b [28/30] xfs: Add parent pointer ioctl
:::::: branch date: 29 hours ago
:::::: commit date: 29 hours ago
config: nios2-randconfig-m031-20220124 (https://download.01.org/0day-ci/archive/20220125/202201250715.EbP8D1XT-lkp(a)intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.2.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>

New smatch warnings:
fs/xfs/xfs_ioctl.c:1753 xfs_ioc_get_parent_pointer() warn: maybe return -EFAULT instead of the bytes remaining?

Old smatch warnings:
arch/nios2/include/asm/thread_info.h:71 current_thread_info() error: uninitialized symbol 'sp'.

vim +1753 fs/xfs/xfs_ioctl.c

36fd6e863cb732 Darrick J. Wong   2017-10-17  1674  
38f492d29e0c25 Allison Henderson 2021-07-23  1675  /*
38f492d29e0c25 Allison Henderson 2021-07-23  1676   * IOCTL routine to get the parent pointers of an inode and return it to user
38f492d29e0c25 Allison Henderson 2021-07-23  1677   * space.  Caller must pass a buffer space containing a struct xfs_pptr_info,
38f492d29e0c25 Allison Henderson 2021-07-23  1678   * followed by a region large enough to contain an array of struct
38f492d29e0c25 Allison Henderson 2021-07-23  1679   * xfs_parent_ptr of a size specified in pi_ptrs_size.  If the inode contains
38f492d29e0c25 Allison Henderson 2021-07-23  1680   * more parent pointers than can fit in the buffer space, caller may re-call
38f492d29e0c25 Allison Henderson 2021-07-23  1681   * the function using the returned pi_cursor to resume iteration.  The
38f492d29e0c25 Allison Henderson 2021-07-23  1682   * number of xfs_parent_ptr returned will be stored in pi_ptrs_used.
38f492d29e0c25 Allison Henderson 2021-07-23  1683   *
38f492d29e0c25 Allison Henderson 2021-07-23  1684   * Returns 0 on success or non-zero on failure
38f492d29e0c25 Allison Henderson 2021-07-23  1685   */
38f492d29e0c25 Allison Henderson 2021-07-23  1686  STATIC int
38f492d29e0c25 Allison Henderson 2021-07-23  1687  xfs_ioc_get_parent_pointer(
38f492d29e0c25 Allison Henderson 2021-07-23  1688  	struct file			*filp,
38f492d29e0c25 Allison Henderson 2021-07-23  1689  	void				__user *arg)
38f492d29e0c25 Allison Henderson 2021-07-23  1690  {
38f492d29e0c25 Allison Henderson 2021-07-23  1691  	struct xfs_pptr_info		*ppi = NULL;
38f492d29e0c25 Allison Henderson 2021-07-23  1692  	int				error = 0;
38f492d29e0c25 Allison Henderson 2021-07-23  1693  	struct xfs_inode		*ip = XFS_I(file_inode(filp));
38f492d29e0c25 Allison Henderson 2021-07-23  1694  	struct xfs_mount		*mp = ip->i_mount;
38f492d29e0c25 Allison Henderson 2021-07-23  1695  
38f492d29e0c25 Allison Henderson 2021-07-23  1696  	if (!capable(CAP_SYS_ADMIN))
38f492d29e0c25 Allison Henderson 2021-07-23  1697  		return -EPERM;
38f492d29e0c25 Allison Henderson 2021-07-23  1698  
38f492d29e0c25 Allison Henderson 2021-07-23  1699  	/* Allocate an xfs_pptr_info to put the user data */
38f492d29e0c25 Allison Henderson 2021-07-23  1700  	ppi = kmem_alloc(sizeof(struct xfs_pptr_info), 0);
38f492d29e0c25 Allison Henderson 2021-07-23  1701  	if (!ppi)
38f492d29e0c25 Allison Henderson 2021-07-23  1702  		return -ENOMEM;
38f492d29e0c25 Allison Henderson 2021-07-23  1703  
38f492d29e0c25 Allison Henderson 2021-07-23  1704  	/* Copy the data from the user */
38f492d29e0c25 Allison Henderson 2021-07-23  1705  	error = copy_from_user(ppi, arg, sizeof(struct xfs_pptr_info));
38f492d29e0c25 Allison Henderson 2021-07-23  1706  	if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1707  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1708  
38f492d29e0c25 Allison Henderson 2021-07-23  1709  	/* Check size of buffer requested by user */
38f492d29e0c25 Allison Henderson 2021-07-23  1710  	if (XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size) > XFS_XATTR_LIST_MAX) {
38f492d29e0c25 Allison Henderson 2021-07-23  1711  		error = -ENOMEM;
38f492d29e0c25 Allison Henderson 2021-07-23  1712  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1713  	}
38f492d29e0c25 Allison Henderson 2021-07-23  1714  
38f492d29e0c25 Allison Henderson 2021-07-23  1715  	/*
38f492d29e0c25 Allison Henderson 2021-07-23  1716  	 * Now that we know how big the trailing buffer is, expand
38f492d29e0c25 Allison Henderson 2021-07-23  1717  	 * our kernel xfs_pptr_info to be the same size
38f492d29e0c25 Allison Henderson 2021-07-23  1718  	 */
38f492d29e0c25 Allison Henderson 2021-07-23  1719  	ppi = krealloc(ppi, XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size),
38f492d29e0c25 Allison Henderson 2021-07-23  1720  		       GFP_NOFS | __GFP_NOFAIL);
38f492d29e0c25 Allison Henderson 2021-07-23  1721  	if (!ppi)
38f492d29e0c25 Allison Henderson 2021-07-23  1722  		return -ENOMEM;
38f492d29e0c25 Allison Henderson 2021-07-23  1723  
38f492d29e0c25 Allison Henderson 2021-07-23  1724  	if (ppi->pi_flags != 0 && ppi->pi_flags != XFS_PPTR_IFLAG_HANDLE) {
38f492d29e0c25 Allison Henderson 2021-07-23  1725  		error = -EINVAL;
38f492d29e0c25 Allison Henderson 2021-07-23  1726  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1727  	}
38f492d29e0c25 Allison Henderson 2021-07-23  1728  
38f492d29e0c25 Allison Henderson 2021-07-23  1729  	if (ppi->pi_flags == XFS_PPTR_IFLAG_HANDLE) {
38f492d29e0c25 Allison Henderson 2021-07-23  1730  		error = xfs_iget(mp, NULL, ppi->pi_handle.ha_fid.fid_ino,
38f492d29e0c25 Allison Henderson 2021-07-23  1731  				0, 0, &ip);
38f492d29e0c25 Allison Henderson 2021-07-23  1732  		if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1733  			goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1734  	}
38f492d29e0c25 Allison Henderson 2021-07-23  1735  
38f492d29e0c25 Allison Henderson 2021-07-23  1736  	if (ip->i_ino == mp->m_sb.sb_rootino)
38f492d29e0c25 Allison Henderson 2021-07-23  1737  		ppi->pi_flags |= XFS_PPTR_OFLAG_ROOT;
38f492d29e0c25 Allison Henderson 2021-07-23  1738  
38f492d29e0c25 Allison Henderson 2021-07-23  1739  	/* Get the parent pointers */
38f492d29e0c25 Allison Henderson 2021-07-23  1740  	error = xfs_attr_get_parent_pointer(ip, ppi);
38f492d29e0c25 Allison Henderson 2021-07-23  1741  
38f492d29e0c25 Allison Henderson 2021-07-23  1742  	if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1743  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1744  
38f492d29e0c25 Allison Henderson 2021-07-23  1745  	/* Copy the parent pointers back to the user */
38f492d29e0c25 Allison Henderson 2021-07-23  1746  	error = copy_to_user(arg, ppi,
38f492d29e0c25 Allison Henderson 2021-07-23  1747  			XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size));
38f492d29e0c25 Allison Henderson 2021-07-23  1748  	if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1749  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1750  
38f492d29e0c25 Allison Henderson 2021-07-23  1751  out:
38f492d29e0c25 Allison Henderson 2021-07-23  1752  	kmem_free(ppi);
38f492d29e0c25 Allison Henderson 2021-07-23 @1753  	return error;
38f492d29e0c25 Allison Henderson 2021-07-23  1754  }
38f492d29e0c25 Allison Henderson 2021-07-23  1755  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [kbuild] [allisonhenderson-xfs-work:delayed_attrs_v26_extended 28/30] fs/xfs/xfs_ioctl.c:1753 xfs_ioc_get_parent_pointer() warn: maybe return -EFAULT instead of the bytes remaining?
Date: Tue, 25 Jan 2022 12:23:34 +0300	[thread overview]
Message-ID: <202201250715.EbP8D1XT-lkp@intel.com> (raw)

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

tree:   https://github.com/allisonhenderson/xfs_work.git  delayed_attrs_v26_extended
head:   19459f5cfa422b0a6a9cd3898892e43ecb49f8f3
commit: 38f492d29e0c25066170d87572b7ade7bf2af72b [28/30] xfs: Add parent pointer ioctl
config: nios2-randconfig-m031-20220124 (https://download.01.org/0day-ci/archive/20220125/202201250715.EbP8D1XT-lkp(a)intel.com/config )
compiler: nios2-linux-gcc (GCC) 11.2.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>

New smatch warnings:
fs/xfs/xfs_ioctl.c:1753 xfs_ioc_get_parent_pointer() warn: maybe return -EFAULT instead of the bytes remaining?

Old smatch warnings:
arch/nios2/include/asm/thread_info.h:71 current_thread_info() error: uninitialized symbol 'sp'.

vim +1753 fs/xfs/xfs_ioctl.c

38f492d29e0c25 Allison Henderson 2021-07-23  1686  STATIC int
38f492d29e0c25 Allison Henderson 2021-07-23  1687  xfs_ioc_get_parent_pointer(
38f492d29e0c25 Allison Henderson 2021-07-23  1688  	struct file			*filp,
38f492d29e0c25 Allison Henderson 2021-07-23  1689  	void				__user *arg)
38f492d29e0c25 Allison Henderson 2021-07-23  1690  {
38f492d29e0c25 Allison Henderson 2021-07-23  1691  	struct xfs_pptr_info		*ppi = NULL;
38f492d29e0c25 Allison Henderson 2021-07-23  1692  	int				error = 0;
38f492d29e0c25 Allison Henderson 2021-07-23  1693  	struct xfs_inode		*ip = XFS_I(file_inode(filp));
38f492d29e0c25 Allison Henderson 2021-07-23  1694  	struct xfs_mount		*mp = ip->i_mount;
38f492d29e0c25 Allison Henderson 2021-07-23  1695  
38f492d29e0c25 Allison Henderson 2021-07-23  1696  	if (!capable(CAP_SYS_ADMIN))
38f492d29e0c25 Allison Henderson 2021-07-23  1697  		return -EPERM;
38f492d29e0c25 Allison Henderson 2021-07-23  1698  
38f492d29e0c25 Allison Henderson 2021-07-23  1699  	/* Allocate an xfs_pptr_info to put the user data */
38f492d29e0c25 Allison Henderson 2021-07-23  1700  	ppi = kmem_alloc(sizeof(struct xfs_pptr_info), 0);
38f492d29e0c25 Allison Henderson 2021-07-23  1701  	if (!ppi)
38f492d29e0c25 Allison Henderson 2021-07-23  1702  		return -ENOMEM;
38f492d29e0c25 Allison Henderson 2021-07-23  1703  
38f492d29e0c25 Allison Henderson 2021-07-23  1704  	/* Copy the data from the user */
38f492d29e0c25 Allison Henderson 2021-07-23  1705  	error = copy_from_user(ppi, arg, sizeof(struct xfs_pptr_info));
38f492d29e0c25 Allison Henderson 2021-07-23  1706  	if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1707  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1708  
38f492d29e0c25 Allison Henderson 2021-07-23  1709  	/* Check size of buffer requested by user */
38f492d29e0c25 Allison Henderson 2021-07-23  1710  	if (XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size) > XFS_XATTR_LIST_MAX) {
38f492d29e0c25 Allison Henderson 2021-07-23  1711  		error = -ENOMEM;
38f492d29e0c25 Allison Henderson 2021-07-23  1712  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1713  	}
38f492d29e0c25 Allison Henderson 2021-07-23  1714  
38f492d29e0c25 Allison Henderson 2021-07-23  1715  	/*
38f492d29e0c25 Allison Henderson 2021-07-23  1716  	 * Now that we know how big the trailing buffer is, expand
38f492d29e0c25 Allison Henderson 2021-07-23  1717  	 * our kernel xfs_pptr_info to be the same size
38f492d29e0c25 Allison Henderson 2021-07-23  1718  	 */
38f492d29e0c25 Allison Henderson 2021-07-23  1719  	ppi = krealloc(ppi, XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size),
38f492d29e0c25 Allison Henderson 2021-07-23  1720  		       GFP_NOFS | __GFP_NOFAIL);
38f492d29e0c25 Allison Henderson 2021-07-23  1721  	if (!ppi)
38f492d29e0c25 Allison Henderson 2021-07-23  1722  		return -ENOMEM;
38f492d29e0c25 Allison Henderson 2021-07-23  1723  
38f492d29e0c25 Allison Henderson 2021-07-23  1724  	if (ppi->pi_flags != 0 && ppi->pi_flags != XFS_PPTR_IFLAG_HANDLE) {
38f492d29e0c25 Allison Henderson 2021-07-23  1725  		error = -EINVAL;
38f492d29e0c25 Allison Henderson 2021-07-23  1726  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1727  	}
38f492d29e0c25 Allison Henderson 2021-07-23  1728  
38f492d29e0c25 Allison Henderson 2021-07-23  1729  	if (ppi->pi_flags == XFS_PPTR_IFLAG_HANDLE) {
38f492d29e0c25 Allison Henderson 2021-07-23  1730  		error = xfs_iget(mp, NULL, ppi->pi_handle.ha_fid.fid_ino,
38f492d29e0c25 Allison Henderson 2021-07-23  1731  				0, 0, &ip);
38f492d29e0c25 Allison Henderson 2021-07-23  1732  		if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1733  			goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1734  	}
38f492d29e0c25 Allison Henderson 2021-07-23  1735  
38f492d29e0c25 Allison Henderson 2021-07-23  1736  	if (ip->i_ino == mp->m_sb.sb_rootino)
38f492d29e0c25 Allison Henderson 2021-07-23  1737  		ppi->pi_flags |= XFS_PPTR_OFLAG_ROOT;
38f492d29e0c25 Allison Henderson 2021-07-23  1738  
38f492d29e0c25 Allison Henderson 2021-07-23  1739  	/* Get the parent pointers */
38f492d29e0c25 Allison Henderson 2021-07-23  1740  	error = xfs_attr_get_parent_pointer(ip, ppi);
38f492d29e0c25 Allison Henderson 2021-07-23  1741  
38f492d29e0c25 Allison Henderson 2021-07-23  1742  	if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1743  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1744  
38f492d29e0c25 Allison Henderson 2021-07-23  1745  	/* Copy the parent pointers back to the user */
38f492d29e0c25 Allison Henderson 2021-07-23  1746  	error = copy_to_user(arg, ppi,
38f492d29e0c25 Allison Henderson 2021-07-23  1747  			XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size));
38f492d29e0c25 Allison Henderson 2021-07-23  1748  	if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1749  		goto out;

This should be

	if (copy_to_user(arg, ppi, XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size))) {
		err = -EFAULT;
		goto out;
	}

38f492d29e0c25 Allison Henderson 2021-07-23  1750  
38f492d29e0c25 Allison Henderson 2021-07-23  1751  out:
38f492d29e0c25 Allison Henderson 2021-07-23  1752  	kmem_free(ppi);
38f492d29e0c25 Allison Henderson 2021-07-23 @1753  	return error;
38f492d29e0c25 Allison Henderson 2021-07-23  1754  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild(a)lists.01.org
To unsubscribe send an email to kbuild-leave(a)lists.01.org

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Allison Henderson <allison.henderson@oracle.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: [kbuild] [allisonhenderson-xfs-work:delayed_attrs_v26_extended 28/30] fs/xfs/xfs_ioctl.c:1753 xfs_ioc_get_parent_pointer() warn: maybe return -EFAULT instead of the bytes remaining?
Date: Tue, 25 Jan 2022 12:23:34 +0300	[thread overview]
Message-ID: <202201250715.EbP8D1XT-lkp@intel.com> (raw)

tree:   https://github.com/allisonhenderson/xfs_work.git  delayed_attrs_v26_extended
head:   19459f5cfa422b0a6a9cd3898892e43ecb49f8f3
commit: 38f492d29e0c25066170d87572b7ade7bf2af72b [28/30] xfs: Add parent pointer ioctl
config: nios2-randconfig-m031-20220124 (https://download.01.org/0day-ci/archive/20220125/202201250715.EbP8D1XT-lkp@intel.com/config )
compiler: nios2-linux-gcc (GCC) 11.2.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>

New smatch warnings:
fs/xfs/xfs_ioctl.c:1753 xfs_ioc_get_parent_pointer() warn: maybe return -EFAULT instead of the bytes remaining?

Old smatch warnings:
arch/nios2/include/asm/thread_info.h:71 current_thread_info() error: uninitialized symbol 'sp'.

vim +1753 fs/xfs/xfs_ioctl.c

38f492d29e0c25 Allison Henderson 2021-07-23  1686  STATIC int
38f492d29e0c25 Allison Henderson 2021-07-23  1687  xfs_ioc_get_parent_pointer(
38f492d29e0c25 Allison Henderson 2021-07-23  1688  	struct file			*filp,
38f492d29e0c25 Allison Henderson 2021-07-23  1689  	void				__user *arg)
38f492d29e0c25 Allison Henderson 2021-07-23  1690  {
38f492d29e0c25 Allison Henderson 2021-07-23  1691  	struct xfs_pptr_info		*ppi = NULL;
38f492d29e0c25 Allison Henderson 2021-07-23  1692  	int				error = 0;
38f492d29e0c25 Allison Henderson 2021-07-23  1693  	struct xfs_inode		*ip = XFS_I(file_inode(filp));
38f492d29e0c25 Allison Henderson 2021-07-23  1694  	struct xfs_mount		*mp = ip->i_mount;
38f492d29e0c25 Allison Henderson 2021-07-23  1695  
38f492d29e0c25 Allison Henderson 2021-07-23  1696  	if (!capable(CAP_SYS_ADMIN))
38f492d29e0c25 Allison Henderson 2021-07-23  1697  		return -EPERM;
38f492d29e0c25 Allison Henderson 2021-07-23  1698  
38f492d29e0c25 Allison Henderson 2021-07-23  1699  	/* Allocate an xfs_pptr_info to put the user data */
38f492d29e0c25 Allison Henderson 2021-07-23  1700  	ppi = kmem_alloc(sizeof(struct xfs_pptr_info), 0);
38f492d29e0c25 Allison Henderson 2021-07-23  1701  	if (!ppi)
38f492d29e0c25 Allison Henderson 2021-07-23  1702  		return -ENOMEM;
38f492d29e0c25 Allison Henderson 2021-07-23  1703  
38f492d29e0c25 Allison Henderson 2021-07-23  1704  	/* Copy the data from the user */
38f492d29e0c25 Allison Henderson 2021-07-23  1705  	error = copy_from_user(ppi, arg, sizeof(struct xfs_pptr_info));
38f492d29e0c25 Allison Henderson 2021-07-23  1706  	if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1707  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1708  
38f492d29e0c25 Allison Henderson 2021-07-23  1709  	/* Check size of buffer requested by user */
38f492d29e0c25 Allison Henderson 2021-07-23  1710  	if (XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size) > XFS_XATTR_LIST_MAX) {
38f492d29e0c25 Allison Henderson 2021-07-23  1711  		error = -ENOMEM;
38f492d29e0c25 Allison Henderson 2021-07-23  1712  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1713  	}
38f492d29e0c25 Allison Henderson 2021-07-23  1714  
38f492d29e0c25 Allison Henderson 2021-07-23  1715  	/*
38f492d29e0c25 Allison Henderson 2021-07-23  1716  	 * Now that we know how big the trailing buffer is, expand
38f492d29e0c25 Allison Henderson 2021-07-23  1717  	 * our kernel xfs_pptr_info to be the same size
38f492d29e0c25 Allison Henderson 2021-07-23  1718  	 */
38f492d29e0c25 Allison Henderson 2021-07-23  1719  	ppi = krealloc(ppi, XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size),
38f492d29e0c25 Allison Henderson 2021-07-23  1720  		       GFP_NOFS | __GFP_NOFAIL);
38f492d29e0c25 Allison Henderson 2021-07-23  1721  	if (!ppi)
38f492d29e0c25 Allison Henderson 2021-07-23  1722  		return -ENOMEM;
38f492d29e0c25 Allison Henderson 2021-07-23  1723  
38f492d29e0c25 Allison Henderson 2021-07-23  1724  	if (ppi->pi_flags != 0 && ppi->pi_flags != XFS_PPTR_IFLAG_HANDLE) {
38f492d29e0c25 Allison Henderson 2021-07-23  1725  		error = -EINVAL;
38f492d29e0c25 Allison Henderson 2021-07-23  1726  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1727  	}
38f492d29e0c25 Allison Henderson 2021-07-23  1728  
38f492d29e0c25 Allison Henderson 2021-07-23  1729  	if (ppi->pi_flags == XFS_PPTR_IFLAG_HANDLE) {
38f492d29e0c25 Allison Henderson 2021-07-23  1730  		error = xfs_iget(mp, NULL, ppi->pi_handle.ha_fid.fid_ino,
38f492d29e0c25 Allison Henderson 2021-07-23  1731  				0, 0, &ip);
38f492d29e0c25 Allison Henderson 2021-07-23  1732  		if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1733  			goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1734  	}
38f492d29e0c25 Allison Henderson 2021-07-23  1735  
38f492d29e0c25 Allison Henderson 2021-07-23  1736  	if (ip->i_ino == mp->m_sb.sb_rootino)
38f492d29e0c25 Allison Henderson 2021-07-23  1737  		ppi->pi_flags |= XFS_PPTR_OFLAG_ROOT;
38f492d29e0c25 Allison Henderson 2021-07-23  1738  
38f492d29e0c25 Allison Henderson 2021-07-23  1739  	/* Get the parent pointers */
38f492d29e0c25 Allison Henderson 2021-07-23  1740  	error = xfs_attr_get_parent_pointer(ip, ppi);
38f492d29e0c25 Allison Henderson 2021-07-23  1741  
38f492d29e0c25 Allison Henderson 2021-07-23  1742  	if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1743  		goto out;
38f492d29e0c25 Allison Henderson 2021-07-23  1744  
38f492d29e0c25 Allison Henderson 2021-07-23  1745  	/* Copy the parent pointers back to the user */
38f492d29e0c25 Allison Henderson 2021-07-23  1746  	error = copy_to_user(arg, ppi,
38f492d29e0c25 Allison Henderson 2021-07-23  1747  			XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size));
38f492d29e0c25 Allison Henderson 2021-07-23  1748  	if (error)
38f492d29e0c25 Allison Henderson 2021-07-23  1749  		goto out;

This should be

	if (copy_to_user(arg, ppi, XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size))) {
		err = -EFAULT;
		goto out;
	}

38f492d29e0c25 Allison Henderson 2021-07-23  1750  
38f492d29e0c25 Allison Henderson 2021-07-23  1751  out:
38f492d29e0c25 Allison Henderson 2021-07-23  1752  	kmem_free(ppi);
38f492d29e0c25 Allison Henderson 2021-07-23 @1753  	return error;
38f492d29e0c25 Allison Henderson 2021-07-23  1754  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org 
_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-leave@lists.01.org


             reply	other threads:[~2022-01-25  0:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25  0:26 kernel test robot [this message]
2022-01-25  9:23 ` [kbuild] [allisonhenderson-xfs-work:delayed_attrs_v26_extended 28/30] fs/xfs/xfs_ioctl.c:1753 xfs_ioc_get_parent_pointer() warn: maybe return -EFAULT instead of the bytes remaining? Dan Carpenter
2022-01-25  9:23 ` Dan Carpenter

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=202201250715.EbP8D1XT-lkp@intel.com \
    --to=lkp@intel.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.