um: Avoid using uninitialized regs

In timer_real_alarm_handler(), regs is only initialized if
the context argument is non-NULL, also initialize in the
other case.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Anton Ivanov <anton.ivanov@cambridgegreys.co.uk>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
Johannes Berg 2019-08-23 12:44:27 +02:00 committed by Richard Weinberger
parent 68c15a2bc5
commit b8f7882028
1 changed files with 3 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include <stdarg.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <strings.h>
#include <as-layout.h>
#include <kern_util.h>
@ -88,6 +89,8 @@ static void timer_real_alarm_handler(mcontext_t *mc)
if (mc != NULL)
get_regs_from_mc(&regs, mc);
else
memset(&regs, 0, sizeof(regs));
timer_handler(SIGALRM, NULL, &regs);
}