git: 83c2118058fd - stable/13 - ia32_get_fpcontext(): xfpusave can be legitimately NULL

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 10 Oct 2021 09:24:12 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=83c2118058fda07dff1248e4e1b2439fb4700d8a

commit 83c2118058fda07dff1248e4e1b2439fb4700d8a
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-09-21 21:09:34 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-10-10 09:21:17 +0000

    ia32_get_fpcontext(): xfpusave can be legitimately NULL
    
    (cherry picked from commit c2ee4dfd04970f1597eea58bb30eb93e1ed5a491)
---
 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 1ca19072a1dc..ab7100f5b9fb 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;