[Devel] [PATCH RHEL10 COMMIT] selftests/uevent: fix -Wmaybe-uninitialized warning in uevent_filtering

Konstantin Khorenko khorenko at virtuozzo.com
Tue Mar 31 23:33:09 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 59f811e23f42a555e036c9f84aaaa48945cfd57d
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Mon Mar 23 21:31:33 2026 +0100

    selftests/uevent: fix -Wmaybe-uninitialized warning in uevent_filtering
    
      uevent_filtering.c: In function 'trigger_uevent':
      uevent_filtering.c:217:16: warning: 'ret' may be used uninitialized [-Wmaybe-uninitialized]
        217 |         return ret;
            |                ^~~
      uevent_filtering.c:197:17: note: 'ret' was declared here
        197 |         int fd, ret;
            |                 ^~~
    
    Initialize 'ret' to 0 in trigger_uevent(). If 'times' is 0, the for
    loop body is never entered and 'ret' would be returned uninitialized.
    
    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/uevent/uevent_filtering.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/uevent/uevent_filtering.c b/tools/testing/selftests/uevent/uevent_filtering.c
index dbe55f3a66f43..8062804ff759a 100644
--- a/tools/testing/selftests/uevent/uevent_filtering.c
+++ b/tools/testing/selftests/uevent/uevent_filtering.c
@@ -194,7 +194,7 @@ static int uevent_listener(unsigned long post_flags, bool expect_uevent,
 
 int trigger_uevent(unsigned int times)
 {
-	int fd, ret;
+	int fd, ret = 0;
 	unsigned int i;
 
 	fd = open(__DEV_FULL, O_RDWR | O_CLOEXEC);


More information about the Devel mailing list