mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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: [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?
Date: Wed, 4 Aug 2021 14:05:59 +0300	[thread overview]
Message-ID: <202108010926.A5KQJjiK-lkp@intel.com> (raw)

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


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

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202108010926.A5KQJjiK-lkp@intel.com \
    --to=dan.carpenter@oracle.com \
    --cc=allison.henderson@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.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 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®