diff mbox series

[next] rtla: Fix uninitialized variable found

Message ID 20230727150117.627730-1-colin.i.king@gmail.com (mailing list archive)
State Accepted
Commit 696444a544ecd6d62c1edc89516b376cefb28929
Headers show
Series [next] rtla: Fix uninitialized variable found | expand

Commit Message

Colin Ian King July 27, 2023, 3:01 p.m. UTC
Variable found is not being initialized, in the case where the desired
mount is not found the variable contains garbage. Fix this by initializing
it to zero.

Fixes: a957cbc02531 ("rtla: Add -C cgroup support")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 tools/tracing/rtla/src/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Bristot de Oliveira July 31, 2023, 3:08 p.m. UTC | #1
On 7/27/23 17:01, Colin Ian King wrote:
> Variable found is not being initialized, in the case where the desired
> mount is not found the variable contains garbage. Fix this by initializing
> it to zero.
> 
> Fixes: a957cbc02531 ("rtla: Add -C cgroup support")
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>

Thanks!
-- Daniel
diff mbox series

Patch

diff --git a/tools/tracing/rtla/src/utils.c b/tools/tracing/rtla/src/utils.c
index 623a38908ed5..c769d7b3842c 100644
--- a/tools/tracing/rtla/src/utils.c
+++ b/tools/tracing/rtla/src/utils.c
@@ -538,7 +538,7 @@  static const int find_mount(const char *fs, char *mp, int sizeof_mp)
 {
 	char mount_point[MAX_PATH];
 	char type[100];
-	int found;
+	int found = 0;
 	FILE *fp;
 
 	fp = fopen("/proc/mounts", "r");