Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jan 2018 21:25:01 +0000 (UTC)
From:      Antoine Brodin <antoine@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327473 - head/sys/kern
Message-ID:  <201801012125.w01LP18T058472@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: antoine
Date: Mon Jan  1 21:25:01 2018
New Revision: 327473
URL: https://svnweb.freebsd.org/changeset/base/327473

Log:
  sysctl_kern_proc_args: do not take the fast path if p_args is NULL
  In this case it falls back to reading ps_strings

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==============================================================================
--- head/sys/kern/kern_proc.c	Mon Jan  1 20:47:03 2018	(r327472)
+++ head/sys/kern/kern_proc.c	Mon Jan  1 21:25:01 2018	(r327473)
@@ -1920,11 +1920,9 @@ sysctl_kern_proc_args(SYSCTL_HANDLER_ARGS)
 	 * is nobody to modify pargs, thus we can just read.
 	 */
 	p = curproc;
-	if (pid == p->p_pid && p->p_numthreads == 1 && req->newptr == NULL) {
-		if ((pa = p->p_args) != NULL)
-			error = SYSCTL_OUT(req, pa->ar_args, pa->ar_length);
-		return (error);
-	}
+	if (pid == p->p_pid && p->p_numthreads == 1 && req->newptr == NULL &&
+	    (pa = p->p_args) != NULL)
+		return (SYSCTL_OUT(req, pa->ar_args, pa->ar_length));
 
 	flags = PGET_CANSEE;
 	if (req->newptr != NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801012125.w01LP18T058472>