signal_handler_unregister() calls sigaction() with uninitializing
sa_flags in the struct sigaction.

Make sure sa_flags is always initialized in signal_handler_unregister()
by initializing the struct sigaction when declaring it.

Fixes: 73c55fa5ab55 (selftests/resctrl: Commonize the signal handler 
register/unregister for all tests)
Suggested-by: Reinette Chatre <[email protected]>
Signed-off-by: Ilpo Järvinen <[email protected]>
Cc: <[email protected]>
---
 tools/testing/selftests/resctrl/resctrl_val.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/resctrl/resctrl_val.c 
b/tools/testing/selftests/resctrl/resctrl_val.c
index 51963a6f2186..1e8b90077218 100644
--- a/tools/testing/selftests/resctrl/resctrl_val.c
+++ b/tools/testing/selftests/resctrl/resctrl_val.c
@@ -504,7 +504,7 @@ int signal_handler_register(void)
  */
 void signal_handler_unregister(void)
 {
-       struct sigaction sigact;
+       struct sigaction sigact = {};
 
        sigact.sa_handler = SIG_DFL;
        sigemptyset(&sigact.sa_mask);
-- 
2.30.2

Reply via email to