Re: [PATCH v5 15/37] tracing: Add variable support to hist triggers

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

 



On Fri, 10 Nov 2017 16:28:41 +0900
Namhyung Kim <namhyung@xxxxxxxxxx> wrote:

> > +			hist_data->attrs->var_defs.expr[n_vars++] = s;
> > +
> > +			hist_data->attrs->var_defs.n_vars = n_vars;
> > +
> > +			if (n_vars == TRACING_MAP_VARS_MAX)
> > +				goto free;  
> 
> This will silently discard all variables.  Why not returning an error?
> Also I think it should be moved to the beginning of this block..

Right, because the check here is already too late. Usually you check
the count before doing the assignment.


	if (n_vars == TRACING_MAP_VARS_MAX)
		goto free;

	hist_data->attrs->var_defs.expr[n_vars++] = s;

Because it is OK for n_vars to equal TRACING_MAP_VARS_MAX, but not OK
to be more.

-- Steve
--
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