[PATCH] libtraceevent: Fix uninitialized variable in eval_num_arg()

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

 



From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 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




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

  Powered by Linux