selftests: Uninitialized variable in test_cgcore_proc_migration()
diff mbox series

Message ID 20200108054629.jtq36feyhxsfhf6u@kili.mountain
State Mainlined
Commit 192c197cbca599321de95a4cf15c2fa0681140d3
Headers show
Series
  • selftests: Uninitialized variable in test_cgcore_proc_migration()
Related show

Commit Message

Dan Carpenter Jan. 8, 2020, 5:46 a.m. UTC
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>
---
 tools/testing/selftests/cgroup/test_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michal Koutný Jan. 8, 2020, 10:17 a.m. UTC | #1
On Wed, Jan 08, 2020 at 08:46:29AM +0300, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> The "c_threads" variable is used in the error handling code before it
> has been initialized
Thank you for fixing this.

Acked-by: Michal Koutný <mkoutny@suse.com>

Michal

Patch
diff mbox series

diff --git a/tools/testing/selftests/cgroup/test_core.c b/tools/testing/selftests/cgroup/test_core.c
index c5ca669feb2b..e19ce940cd6a 100644
--- a/tools/testing/selftests/cgroup/test_core.c
+++ b/tools/testing/selftests/cgroup/test_core.c
@@ -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];