svn commit: r270999 - head/sys/kern

John-Mark Gurney jmg at funkthat.com
Thu Sep 4 17:11:53 UTC 2014


Gleb Smirnoff wrote this message on Thu, Sep 04, 2014 at 13:18 +0400:
> 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.

Sorry, misread the diff, you are correct...

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."


More information about the svn-src-all mailing list