Re: [PATCH 8/9] libtraceeval: Add checks to traceeval_insert() and query()

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

 



On Thu, Aug 17, 2023 at 06:24:21PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>
> 
> Now that there are size functions for traceeval_insert() and
> traceveal_query(), add checks to make sure that the size being passed in
> is actually the size expected.

This looks fine, but I think it should be squashed with the previous commit so
we pass in the size and check it in the same patch.

Reviewed-by: Ross Zwisler <zwisler@xxxxxxxxxx>

> 
> Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
> ---
>  src/histograms.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/histograms.c b/src/histograms.c
> index 5e2e9200cbf6..973bf3ad279c 100644
> --- a/src/histograms.c
> +++ b/src/histograms.c
> @@ -684,6 +684,9 @@ int traceeval_query_size(struct traceeval *teval, const struct traceeval_data *k
>  	if (!teval || !keys || !results)
>  		return -1;
>  
> +	if (nr_keys != teval->nr_key_types)
> +		return -1;
> +
>  	/* find key and copy its corresponding value pair */
>  	if ((check = get_entry(teval, keys, &entry)) < 1)
>  		return check;
> @@ -936,6 +939,9 @@ int traceeval_insert_size(struct traceeval *teval,
>  	int check;
>  	int i;
>  
> +	if (nr_keys != teval->nr_key_types || nr_vals != teval->nr_val_types)
> +		return -1;
> +
>  	entry = NULL;
>  	check = get_entry(teval, keys, &entry);
>  
> -- 
> 2.40.1
> 



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

  Powered by Linux