svn commit: r270999 - head/sys/kern

Gleb Smirnoff glebius at FreeBSD.org
Thu Sep 4 09:18:49 UTC 2014


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.


More information about the svn-src-all mailing list