linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libtraceevent: Fix uninitialized variable in eval_num_arg()
@ 2022-09-23 16:30 Steven Rostedt
  2022-09-23 20:59 ` Ross Zwisler
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2022-09-23 16:30 UTC (permalink / raw)
  To: Linux Trace Devel; +Cc: Ross Zwisler

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

It appears that my compiler version did not notice that "field_size"
passed to check_data_offset_size() in the TEP_PRINT_DYNAMIC_ARRAY case was
not initialized. But other compilers do.

Since this case we just want to make sure the offset is not passed the end
of the event data, we can simply pass in zero.

Fixes: efd32896dd5db ("libtraceevent: Add warnings if fields are outside the event")
Reported-by: Ross Zwisler <zwisler@google.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/event-parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/event-parse.c b/src/event-parse.c
index 980e980985ad..a0458e548765 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -4310,7 +4310,7 @@ eval_num_arg(void *data, int size, struct tep_event *event, struct tep_print_arg
 		dynamic_offset_field(tep, arg->dynarray.field, data, size,
 				     &offset, NULL);
 		if (check_data_offset_size(event, arg->field.name, size,
-					   offset, field_size)) {
+					   offset, 0)) {
 			val = (unsigned long)data;
 			break;
 		}
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libtraceevent: Fix uninitialized variable in eval_num_arg()
  2022-09-23 16:30 [PATCH] libtraceevent: Fix uninitialized variable in eval_num_arg() Steven Rostedt
@ 2022-09-23 20:59 ` Ross Zwisler
  0 siblings, 0 replies; 2+ messages in thread
From: Ross Zwisler @ 2022-09-23 20:59 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Linux Trace Devel

On Fri, Sep 23, 2022 at 12:30:14PM -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> It appears that my compiler version did not notice that "field_size"
> passed to check_data_offset_size() in the TEP_PRINT_DYNAMIC_ARRAY case was
> not initialized. But other compilers do.
> 
> Since this case we just want to make sure the offset is not passed the end
> of the event data, we can simply pass in zero.
> 
> Fixes: efd32896dd5db ("libtraceevent: Add warnings if fields are outside the event")
> Reported-by: Ross Zwisler <zwisler@google.com>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Reviewed-by: Ross Zwisler <zwisler@google.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-23 21:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-23 16:30 [PATCH] libtraceevent: Fix uninitialized variable in eval_num_arg() Steven Rostedt
2022-09-23 20:59 ` Ross Zwisler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).