Blame libtracefs-Call-va_end-before-exiting-tracefs_hist_s.patch
|
Jerome Marchand |
3772ca |
From aecc0b7b4d5ba986517fb86fb0a87a110ad0c816 Mon Sep 17 00:00:00 2001
|
|
Jerome Marchand |
3772ca |
From: Jerome Marchand <jmarchan@redhat.com>
|
|
Jerome Marchand |
3772ca |
Date: Thu, 6 Jun 2024 17:38:15 +0200
|
|
Jerome Marchand |
3772ca |
Subject: [PATCH 01/15] libtracefs: Call va_end() before exiting
|
|
Jerome Marchand |
3772ca |
tracefs_hist_set_sort_key()
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Each invocation of va_start() must be matched by a corresponding
|
|
Jerome Marchand |
3772ca |
invocation of va_end() in the same function. If add_sort_key() fails,
|
|
Jerome Marchand |
3772ca |
tracefs_hist_set_sort_key() exits without calling it. Call va_end
|
|
Jerome Marchand |
3772ca |
after add_sort_key() fails.
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Fixes a VARARGS error (CWE-237)
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Link: https://lore.kernel.org/linux-trace-devel/20240606153830.2666120-2-jmarchan@redhat.com
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
Fixes: 5d1c2ea2d6a7b ("libtracefs: Implement API to create / modify and display histograms")
|
|
Jerome Marchand |
3772ca |
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
|
|
Jerome Marchand |
3772ca |
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
|
|
Jerome Marchand |
3772ca |
---
|
|
Jerome Marchand |
3772ca |
src/tracefs-hist.c | 4 +++-
|
|
Jerome Marchand |
3772ca |
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
Jerome Marchand |
3772ca |
|
|
Jerome Marchand |
3772ca |
diff --git a/src/tracefs-hist.c b/src/tracefs-hist.c
|
|
Jerome Marchand |
3772ca |
index 2b4f17f..87287b5 100644
|
|
Jerome Marchand |
3772ca |
--- a/src/tracefs-hist.c
|
|
Jerome Marchand |
3772ca |
+++ b/src/tracefs-hist.c
|
|
Jerome Marchand |
3772ca |
@@ -596,8 +596,10 @@ int tracefs_hist_set_sort_key(struct tracefs_hist *hist,
|
|
Jerome Marchand |
3772ca |
if (!sort_key)
|
|
Jerome Marchand |
3772ca |
break;
|
|
Jerome Marchand |
3772ca |
tmp = add_sort_key(hist, sort_key, list);
|
|
Jerome Marchand |
3772ca |
- if (!tmp)
|
|
Jerome Marchand |
3772ca |
+ if (!tmp) {
|
|
Jerome Marchand |
3772ca |
+ va_end(ap);
|
|
Jerome Marchand |
3772ca |
goto fail;
|
|
Jerome Marchand |
3772ca |
+ }
|
|
Jerome Marchand |
3772ca |
list = tmp;
|
|
Jerome Marchand |
3772ca |
}
|
|
Jerome Marchand |
3772ca |
va_end(ap);
|
|
Jerome Marchand |
3772ca |
--
|
|
Jerome Marchand |
3772ca |
2.45.2
|
|
Jerome Marchand |
3772ca |
|