Message ID | 20230817222422.118568-9-rostedt@goodmis.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | libtraceeval: Even more updates! | expand |
On Thu, Aug 17, 2023 at 06:24:21PM -0400, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" <rostedt@goodmis.org> > > 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@google.com> > > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> > --- > 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 >
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);