[Devel] [PATCH RHEL10 COMMIT] selftests/cgroup: fix -Wmaybe-uninitialized warning in test_numa_migrate

Konstantin Khorenko khorenko at virtuozzo.com
Tue Mar 31 23:32:59 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-55.52.1.5.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-55.52.1.5.12.vz10
------>
commit ba6d2eaf3715421d58ee9665d0fc16c30b51814a
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Mon Mar 23 21:31:20 2026 +0100

    selftests/cgroup: fix -Wmaybe-uninitialized warning in test_numa_migrate
    
      test_numa_migrate.c: In function 'parse_memory_numa_stat.isra':
      test_numa_migrate.c:521:34: warning: 'node' may be used uninitialized [-Wmaybe-uninitialized]
        521 |                         node_stat[node] = node_bytes;
            |                                  ^
      test_numa_migrate.c:485:16: note: 'node' was declared here
        485 |         size_t node;
            |                ^~~~
    
    Initialize 'node' to 0 to silence the -Wmaybe-uninitialized warning.
    The variable is always set inside the loop before use in the else branch,
    but GCC cannot prove this statically.
    
    https://virtuozzo.atlassian.net/browse/VSTOR-127529
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    Reviewed-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>
    
    Feature: fix selftests
---
 tools/testing/selftests/cgroup/test_numa_migrate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/cgroup/test_numa_migrate.c b/tools/testing/selftests/cgroup/test_numa_migrate.c
index e5119da4fc015..5f4a55684f61a 100644
--- a/tools/testing/selftests/cgroup/test_numa_migrate.c
+++ b/tools/testing/selftests/cgroup/test_numa_migrate.c
@@ -510,6 +510,7 @@ static int parse_memory_numa_stat(struct test_context *ctx, const char *cgroup,
 	token = strtok(stat_str, node_delim);
 	/* skip the key itself */
 	token = strtok(NULL, node_delim);
+	node = 0;
 	step = 1;
 	while (token != NULL) {
 		if (step % 2) {


More information about the Devel mailing list