selftests: Uninitialized variable in test_cgcore_proc_migration()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 8 Jan 2020 05:46:29 +0000 (08:46 +0300)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 9 Jan 2020 23:21:23 +0000 (16:21 -0700)
The "c_threads" variable is used in the error handling code before it
has been initialized

Fixes: 11318989c381 ("selftests: cgroup: Add task migration tests")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/cgroup/test_core.c

index c5ca669..e19ce94 100644 (file)
@@ -369,7 +369,7 @@ static void *dummy_thread_fn(void *arg)
 static int test_cgcore_proc_migration(const char *root)
 {
        int ret = KSFT_FAIL;
-       int t, c_threads, n_threads = 13;
+       int t, c_threads = 0, n_threads = 13;
        char *src = NULL, *dst = NULL;
        pthread_t threads[n_threads];