rtla: Fix uninitialized variable found
authorColin Ian King <colin.i.king@gmail.com>
Thu, 27 Jul 2023 15:01:17 +0000 (16:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:59:29 +0000 (11:59 +0100)
[ Upstream commit 696444a544ecd6d62c1edc89516b376cefb28929 ]

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.

Link: https://lore.kernel.org/all/20230727150117.627730-1-colin.i.king@gmail.com/
Fixes: a957cbc02531 ("rtla: Add -C cgroup support")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/tracing/rtla/src/utils.c

index 623a389..c769d7b 100644 (file)
@@ -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");