Skip to content

Commit beb7f47

Browse files
ij-intelshuahkh
authored andcommitted
selftests/resctrl: Fix uninitialized .sa_flags
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. Also add the initialization to signal_handler_register() even if there are no know bugs in there because correctness is then obvious from the code itself. Fixes: 73c55fa ("selftests/resctrl: Commonize the signal handler register/unregister for all tests") Suggested-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Cc: <stable@vger.kernel.org> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent f23c792 commit beb7f47

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/testing/selftests/resctrl/resctrl_val.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ void ctrlc_handler(int signum, siginfo_t *info, void *ptr)
482482
*/
483483
int signal_handler_register(void)
484484
{
485-
struct sigaction sigact;
485+
struct sigaction sigact = {};
486486
int ret = 0;
487487

488488
sigact.sa_sigaction = ctrlc_handler;
@@ -504,7 +504,7 @@ int signal_handler_register(void)
504504
*/
505505
void signal_handler_unregister(void)
506506
{
507-
struct sigaction sigact;
507+
struct sigaction sigact = {};
508508

509509
sigact.sa_handler = SIG_DFL;
510510
sigemptyset(&sigact.sa_mask);

0 commit comments

Comments
 (0)