Date: Thu, 4 Sep 2014 13:18:44 +0400 From: Gleb Smirnoff <glebius@FreeBSD.org> To: John-Mark Gurney <jmg@funkthat.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Mateusz Guzik <mjguzik@gmail.com>, kib@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r270999 - head/sys/kern Message-ID: <20140904091844.GC7693@FreeBSD.org> In-Reply-To: <20140903191028.GG71691@funkthat.com> References: <201409030814.s838E7A2084257@svn.freebsd.org> <20140903085523.GB13871@dft-labs.eu> <20140903094916.GO7693@FreeBSD.org> <20140903191028.GG71691@funkthat.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 03, 2014 at 12:10:28PM -0700, John-Mark Gurney wrote:
J> > M> > + if (p->p_pptr) {
J> > M> > kp->ki_ppid = proc_realparent(p)->p_pid;
J> > M> > - if (p->p_flag & P_TRACED)
J> > M> > - kp->ki_tracer = p->p_pptr->p_pid;
J> > M> > + if (p->p_flag & P_TRACED)
J> > M> > + kp->ki_tracer = p->p_pptr->p_pid;
J> > M> > + }
J> > M> > }
J> > M> >
J> > M> > /*
J> > M> >
J> > M>
J> > M> p_pptr must be non-NULL if P_TRACED is set. If there is no way to
J> > M> annotate it for coverity, this change deserves a comment in the code
J> > M> (and in retrospect previous code should have had appropriate comment as
J> > M> well).
J> >
J> > Thanks for explanation.
J> >
J> > I'd suggest to leave the change in, since now it is a micro-micro-optimization :)
J>
J> If you must leave it in, then at least compare the pointer against
J> NULL, and collapse two if statements into one...
J>
J> We should never introduce new pointer checks that aren't against NULL...
I don't see how two if statements can be collapsed? We need to assign
ki_ppid regardless of P_TRACED flag.
--
Totus tuus, Glebius.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140904091844.GC7693>
