[PATCH 2/6] libtraceevent: Fix tep_kbuffer() to have kbuf assign long_size

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

 



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

If the tep handle that returns the kbuf from tep_kbuffer() did not have its
long_size initialized, neither will the kbuffer it returns. This can cause
inconsistent results. Default the long_size to the "commit" size of the header
page as that should also be the size of long.

Fixes: 21ba6336 ("libtraceevent: Add kbuffer_create()")
Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>
---
 src/parse-utils.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/parse-utils.c b/src/parse-utils.c
index 9c38e1e644d7..b434e24e44df 100644
--- a/src/parse-utils.c
+++ b/src/parse-utils.c
@@ -137,6 +137,11 @@ struct kbuffer *tep_kbuffer(struct tep_handle *tep)
 	int long_size;
 
 	long_size = tep_get_long_size(tep);
+
+	/* If the long_size is not set, then use the commit size */
+	if (!long_size)
+		long_size = tep_get_header_page_size(tep);
+
 	if (long_size == 8)
 		long_size = KBUFFER_LSIZE_8;
 	else
-- 
2.42.0





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

  Powered by Linux