From 403ddccb10e2130fd363fddeb99481d7afb5b03b Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sat, 15 Oct 2016 09:54:22 +0000 Subject: [PATCH] Check we are in a critical section when calling vfp_discard. As we may call it with a NULL thread pointer only check when it is non-NULL. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation --- sys/arm64/arm64/vfp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c index 8e648336342..f1fbb56a352 100644 --- a/sys/arm64/arm64/vfp.c +++ b/sys/arm64/arm64/vfp.c @@ -79,6 +79,10 @@ void vfp_discard(struct thread *td) { +#ifdef INVARIANTS + if (td != NULL) + CRITICAL_ASSERT(td); +#endif if (PCPU_GET(fpcurthread) == td) PCPU_SET(fpcurthread, NULL);