From c2ee4dfd04970f1597eea58bb30eb93e1ed5a491 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Wed, 22 Sep 2021 00:09:34 +0300 Subject: [PATCH] ia32_get_fpcontext(): xfpusave can be legitimately NULL Reported by: cy Sponsored by: The FreeBSD Foundation MFC after: 1 week Fixes: bd9e0f5df681da8b5ef05 --- sys/amd64/ia32/ia32_signal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 1ca19072a1d..ab7100f5b9f 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -99,6 +99,8 @@ ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, bcopy(get_pcb_user_save_td(td), &mcp->mc_fpstate[0], sizeof(mcp->mc_fpstate)); mcp->mc_fpformat = fpuformat(); + if (xfpusave == NULL) + return; if (!use_xsave || cpu_max_ext_state_size <= sizeof(struct savefpu)) { *xfpusave_len = 0; *xfpusave = NULL;