All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Christian Brauner <brauner@kernel.org>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Jan Kara <jack@suse.cz>
Subject: kernel/fork.c:1962: warning: bad line:
Date: Thu, 17 Aug 2023 22:00:42 +0800	[thread overview]
Message-ID: <202308172133.Hs40Ti6o-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4853c74bd7ab7fdb83f319bd9ace8a08c031e9b6
commit: 6ae930d9dbf2d093157be33428538c91966d8a9f pid: add pidfd_prepare()
date:   5 months ago
config: nios2-defconfig (https://download.01.org/0day-ci/archive/20230817/202308172133.Hs40Ti6o-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230817/202308172133.Hs40Ti6o-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308172133.Hs40Ti6o-lkp@intel.com/

All warnings (new ones prefixed by >>):

   kernel/fork.c:1261: warning: Function parameter or member 'mm' not described in 'set_mm_exe_file'
   kernel/fork.c:1261: warning: Function parameter or member 'new_exe_file' not described in 'set_mm_exe_file'
   kernel/fork.c:1298: warning: Function parameter or member 'mm' not described in 'replace_mm_exe_file'
   kernel/fork.c:1298: warning: Function parameter or member 'new_exe_file' not described in 'replace_mm_exe_file'
   kernel/fork.c:1350: warning: Function parameter or member 'mm' not described in 'get_mm_exe_file'
   kernel/fork.c:1369: warning: Function parameter or member 'task' not described in 'get_task_exe_file'
   kernel/fork.c:1393: warning: Function parameter or member 'task' not described in 'get_task_mm'
>> kernel/fork.c:1962: warning: bad line: 
>> kernel/fork.c:1983: warning: Function parameter or member 'ret' not described in '__pidfd_prepare'
>> kernel/fork.c:1983: warning: Excess function parameter 'pidfd' description in '__pidfd_prepare'
>> kernel/fork.c:2032: warning: Function parameter or member 'ret' not described in 'pidfd_prepare'
>> kernel/fork.c:2032: warning: Excess function parameter 'pidfd' description in 'pidfd_prepare'
   kernel/fork.c:3048: warning: expecting prototype for clone3(). Prototype was for sys_clone3() instead


vim +1962 kernel/fork.c

  1953	
  1954	/**
  1955	 * __pidfd_prepare - allocate a new pidfd_file and reserve a pidfd
  1956	 * @pid:   the struct pid for which to create a pidfd
  1957	 * @flags: flags of the new @pidfd
  1958	 * @pidfd: the pidfd to return
  1959	 *
  1960	 * Allocate a new file that stashes @pid and reserve a new pidfd number in the
  1961	 * caller's file descriptor table. The pidfd is reserved but not installed yet.
> 1962	
  1963	 * The helper doesn't perform checks on @pid which makes it useful for pidfds
  1964	 * created via CLONE_PIDFD where @pid has no task attached when the pidfd and
  1965	 * pidfd file are prepared.
  1966	 *
  1967	 * If this function returns successfully the caller is responsible to either
  1968	 * call fd_install() passing the returned pidfd and pidfd file as arguments in
  1969	 * order to install the pidfd into its file descriptor table or they must use
  1970	 * put_unused_fd() and fput() on the returned pidfd and pidfd file
  1971	 * respectively.
  1972	 *
  1973	 * This function is useful when a pidfd must already be reserved but there
  1974	 * might still be points of failure afterwards and the caller wants to ensure
  1975	 * that no pidfd is leaked into its file descriptor table.
  1976	 *
  1977	 * Return: On success, a reserved pidfd is returned from the function and a new
  1978	 *         pidfd file is returned in the last argument to the function. On
  1979	 *         error, a negative error code is returned from the function and the
  1980	 *         last argument remains unchanged.
  1981	 */
  1982	static int __pidfd_prepare(struct pid *pid, unsigned int flags, struct file **ret)
> 1983	{
  1984		int pidfd;
  1985		struct file *pidfd_file;
  1986	
  1987		if (flags & ~(O_NONBLOCK | O_RDWR | O_CLOEXEC))
  1988			return -EINVAL;
  1989	
  1990		pidfd = get_unused_fd_flags(O_RDWR | O_CLOEXEC);
  1991		if (pidfd < 0)
  1992			return pidfd;
  1993	
  1994		pidfd_file = anon_inode_getfile("[pidfd]", &pidfd_fops, pid,
  1995						flags | O_RDWR | O_CLOEXEC);
  1996		if (IS_ERR(pidfd_file)) {
  1997			put_unused_fd(pidfd);
  1998			return PTR_ERR(pidfd_file);
  1999		}
  2000		get_pid(pid); /* held by pidfd_file now */
  2001		*ret = pidfd_file;
  2002		return pidfd;
  2003	}
  2004	
  2005	/**
  2006	 * pidfd_prepare - allocate a new pidfd_file and reserve a pidfd
  2007	 * @pid:   the struct pid for which to create a pidfd
  2008	 * @flags: flags of the new @pidfd
  2009	 * @pidfd: the pidfd to return
  2010	 *
  2011	 * Allocate a new file that stashes @pid and reserve a new pidfd number in the
  2012	 * caller's file descriptor table. The pidfd is reserved but not installed yet.
  2013	 *
  2014	 * The helper verifies that @pid is used as a thread group leader.
  2015	 *
  2016	 * If this function returns successfully the caller is responsible to either
  2017	 * call fd_install() passing the returned pidfd and pidfd file as arguments in
  2018	 * order to install the pidfd into its file descriptor table or they must use
  2019	 * put_unused_fd() and fput() on the returned pidfd and pidfd file
  2020	 * respectively.
  2021	 *
  2022	 * This function is useful when a pidfd must already be reserved but there
  2023	 * might still be points of failure afterwards and the caller wants to ensure
  2024	 * that no pidfd is leaked into its file descriptor table.
  2025	 *
  2026	 * Return: On success, a reserved pidfd is returned from the function and a new
  2027	 *         pidfd file is returned in the last argument to the function. On
  2028	 *         error, a negative error code is returned from the function and the
  2029	 *         last argument remains unchanged.
  2030	 */
  2031	int pidfd_prepare(struct pid *pid, unsigned int flags, struct file **ret)
> 2032	{
  2033		if (!pid || !pid_has_task(pid, PIDTYPE_TGID))
  2034			return -EINVAL;
  2035	
  2036		return __pidfd_prepare(pid, flags, ret);
  2037	}
  2038	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2023-08-17 14:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-17 14:00 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-08-30 10:28 kernel/fork.c:1962: warning: bad line: 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=202308172133.Hs40Ti6o-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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.