Blame libtracefs-Initialize-val-in-build_filter.patch

Jerome Marchand 3772ca
From e6737d4ee9de9af86061de58cbb3fcb14fd0ffbc 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:29 +0200
Jerome Marchand 3772ca
Subject: [PATCH 15/15] libtracefs: Initialize val in build_filter()
Jerome Marchand 3772ca
Jerome Marchand 3772ca
In build_filter(), val is only initialized if filter->rval->type is
Jerome Marchand 3772ca
either EXPR_NUMBER or EXPR_STRING. AS far as I can understand that is
Jerome Marchand 3772ca
expected at that point. Howvever, it doesn't cost much to initialize
Jerome Marchand 3772ca
it in case the parser let some bogus request pass by and it should
Jerome Marchand 3772ca
prevent the static analyser to complain.
Jerome Marchand 3772ca
Jerome Marchand 3772ca
Link: https://lore.kernel.org/linux-trace-devel/20240606153830.2666120-16-jmarchan@redhat.com
Jerome Marchand 3772ca
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-sqlhist.c | 2 +-
Jerome Marchand 3772ca
 1 file changed, 1 insertion(+), 1 deletion(-)
Jerome Marchand 3772ca
Jerome Marchand 3772ca
diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
Jerome Marchand 3772ca
index 0f678c1..08bd0fa 100644
Jerome Marchand 3772ca
--- a/src/tracefs-sqlhist.c
Jerome Marchand 3772ca
+++ b/src/tracefs-sqlhist.c
Jerome Marchand 3772ca
@@ -1109,7 +1109,7 @@ static int build_filter(struct tep_handle *tep, struct sqlhist_bison *sb,
Jerome Marchand 3772ca
 			     const char *val);
Jerome Marchand 3772ca
 	struct filter *filter = &expr->filter;
Jerome Marchand 3772ca
 	enum tracefs_compare cmp;
Jerome Marchand 3772ca
-	const char *val;
Jerome Marchand 3772ca
+	const char *val = NULL;
Jerome Marchand 3772ca
 	int and_or = TRACEFS_FILTER_AND;
Jerome Marchand 3772ca
 	char num[64];
Jerome Marchand 3772ca
 	int ret;
Jerome Marchand 3772ca
-- 
Jerome Marchand 3772ca
2.45.2
Jerome Marchand 3772ca