Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Sep 2014 10:11:52 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        Gleb Smirnoff <glebius@freebsd.org>
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:  <20140904171151.GF82175@funkthat.com>
In-Reply-To: <20140904091844.GC7693@FreeBSD.org>
References:  <201409030814.s838E7A2084257@svn.freebsd.org> <20140903085523.GB13871@dft-labs.eu> <20140903094916.GO7693@FreeBSD.org> <20140903191028.GG71691@funkthat.com> <20140904091844.GC7693@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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."



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