mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [allisonhenderson-xfs_work:delayed_attrs_v22_extended 32/32] fs/xfs/xfs_ioctl.c:1834 xfs_ioc_get_parent_pointer() warn: maybe return -EFAULT instead of the bytes remaining?
@ 2021-08-04 11:05 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-08-04 11:05 UTC (permalink / raw)
  To: kbuild, Allison Henderson; +Cc: lkp, kbuild-all, linux-kernel

tree:   https://github.com/allisonhenderson/xfs_work.git delayed_attrs_v22_extended
head:   aff89515c2d9aca9b24ac0296f3806af62cd9206
commit: aff89515c2d9aca9b24ac0296f3806af62cd9206 [32/32] xfs: Add parent pointer ioctl
config: microblaze-randconfig-m031-20210730 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 10.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>

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

vim +1834 fs/xfs/xfs_ioctl.c

aff89515c2d9aca Allison Henderson 2021-07-23  1817  	if (ip->i_ino == mp->m_sb.sb_rootino)
aff89515c2d9aca Allison Henderson 2021-07-23  1818  		ppi->pi_flags |= XFS_PPTR_OFLAG_ROOT;
aff89515c2d9aca Allison Henderson 2021-07-23  1819  
aff89515c2d9aca Allison Henderson 2021-07-23  1820  	/* Get the parent pointers */
aff89515c2d9aca Allison Henderson 2021-07-23  1821  	error = xfs_attr_get_parent_pointer(ip, ppi);
aff89515c2d9aca Allison Henderson 2021-07-23  1822  
aff89515c2d9aca Allison Henderson 2021-07-23  1823  	if (error)
aff89515c2d9aca Allison Henderson 2021-07-23  1824  		goto out;
aff89515c2d9aca Allison Henderson 2021-07-23  1825  
aff89515c2d9aca Allison Henderson 2021-07-23  1826  	/* Copy the parent pointers back to the user */
aff89515c2d9aca Allison Henderson 2021-07-23  1827  	error = copy_to_user(arg, ppi,
aff89515c2d9aca Allison Henderson 2021-07-23  1828  			XFS_PPTR_INFO_SIZEOF(ppi->pi_ptrs_size));
aff89515c2d9aca Allison Henderson 2021-07-23  1829  	if (error)
aff89515c2d9aca Allison Henderson 2021-07-23  1830  		goto out;

This needs to be:

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

aff89515c2d9aca Allison Henderson 2021-07-23  1831  
aff89515c2d9aca Allison Henderson 2021-07-23  1832  out:
aff89515c2d9aca Allison Henderson 2021-07-23  1833  	kmem_free(ppi);
aff89515c2d9aca Allison Henderson 2021-07-23 @1834  	return error;
aff89515c2d9aca Allison Henderson 2021-07-23  1835  }

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


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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-04 11:05 [allisonhenderson-xfs_work:delayed_attrs_v22_extended 32/32] fs/xfs/xfs_ioctl.c:1834 xfs_ioc_get_parent_pointer() warn: maybe return -EFAULT instead of the bytes remaining? Dan Carpenter

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

all inboxes | Powered by JetHome®