Re: [RFC][PATCH 02/21] tracing: Reimplement log2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2017-02-08 at 15:13 -0500, Steven Rostedt wrote:
> On Wed,  8 Feb 2017 11:24:58 -0600
> Tom Zanussi <tom.zanussi@xxxxxxxxxxxxxxx> wrote:
> 
> >  static void destroy_hist_field(struct hist_field *hist_field)
> >  {
> > +	unsigned int i;
> > +
> > +	if (!hist_field)
> > +		return;
> > +
> > +	for (i = 0; i < HIST_FIELD_OPERANDS_MAX; i++)
> > +		destroy_hist_field(hist_field->operands[i]);
> 
> Recursive functions get me really nervous. What limits it? Is this user
> defined? Perhaps we need to find a better way to handle this that's not
> recursive, or at least put in a hard limit of the amount it can recurse.
> 

It's limited by the expression depth, which shouldn't be more than 1
deep, but you're right, there should be an explicit limit check, just in
case - will add one.

Tom

> -- Steve
> 
> > +
> >  	kfree(hist_field);
> >  }
> >  
> > @@ -377,7 +393,10 @@ static struct hist_field *create_hist_field(struct ftrace_event_field *field,
> >  	}
> >  
> >  	if (flags & HIST_FIELD_FL_LOG2) {
> > +		unsigned long fl = flags & ~HIST_FIELD_FL_LOG2;
> >  		hist_field->fn = hist_field_log2;
> > +		hist_field->operands[0] = create_hist_field(field, fl);
> > +		hist_field->size = hist_field->operands[0]->size;
> >  		goto out;
> >  	}
> >  
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux