[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] i386/i386/fpu.c: check machine state before setting fp_valid
From: |
Marin Ramesa |
Subject: |
[PATCH 2/2] i386/i386/fpu.c: check machine state before setting fp_valid |
Date: |
Sun, 17 Nov 2013 07:01:26 +0100 |
When fp_thread is not NULL and is not the current thread, and fp_save() does
not alter the machine state, check if ifps is NULL before setting fp_valid
to avoid dereference of null pointer.
* i386/i386/fpu.c (ifps): Check if it's NULL.
---
i386/i386/fpu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c
index fb2c8ce..226f4ea 100644
--- a/i386/i386/fpu.c
+++ b/i386/i386/fpu.c
@@ -640,7 +640,8 @@ fphandleerr()
*/
clear_ts();
fp_save(fp_thread);
- fp_thread->pcb->ims.ifps->fp_valid = 2;
+ if (fp_thread->pcb->ims.ifps != NULL)
+ fp_thread->pcb->ims.ifps->fp_valid = 2;
fninit();
clear_fpu();
/* leave fp_intr_thread THREAD_NULL */
--
1.8.1.4