Re: [PATCH 7/9] libtraceeval: Add size checks to insert and query functions

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

 



On Thu, 17 Aug 2023 18:24:20 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> --- a/include/traceeval-hist.h
> +++ b/include/traceeval-hist.h
> @@ -186,15 +186,23 @@ struct traceeval *traceeval_init(struct traceeval_type *keys,
>  
>  void traceeval_release(struct traceeval *teval);
>  
> -int traceeval_insert(struct traceeval *teval,
> -		     const struct traceeval_data *keys,
> -		     const struct traceeval_data *vals);
> +int traceeval_insert_size(struct traceeval *teval,
> +			  const struct traceeval_data *keys, size_t nr_keys,
> +			  const struct traceeval_data *vals, size_t nr_vals);
> +
> +#define traceeval_insert(teval, keys, vals)				\
> +	traceeval_insert_size(teval, keys, sizeof(keys) / sizeof(keys[0]), \
> +			      vals, sizeof(vals) / sizeof(vals[0]))
>  
>  int traceeval_remove(struct traceeval *teval,
>  		     const struct traceeval_data *keys);
>  
> -int traceeval_query(struct traceeval *teval, const struct traceeval_data *keys,
> -		    const struct traceeval_data **results);
> +int traceeval_query_size(struct traceeval *teval, const struct traceeval_data *keys,
> +			 size_t nr_keys, const struct traceeval_data **results);
> +
> +#define traceeval_query(teval, keys, results)				\
> +	traceeval_query_size(teval, keys,				\
> +			     sizeof(keys) / sizeof(keys[0]), results);

That has an ';' at the end, and it causes failures for:

	if (traceeval_query(...) > 0)

(which I have in my trace-flames.c code).

I'll fix in v2.

-- Steve




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux