[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/5] kern/processor.c: check if threads is NULL
From: |
Marin Ramesa |
Subject: |
[PATCH 3/5] kern/processor.c: check if threads is NULL |
Date: |
Tue, 19 Nov 2013 07:34:21 +0100 |
When addr is equal to zero, array access from pointer threads
results in a dereference of null pointer. Avoid this by checking
if it's NULL.
* kern/processor.c (threads): Check if it's NULL.
---
kern/processor.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kern/processor.c b/kern/processor.c
index 0cb9974..9da06f5 100644
--- a/kern/processor.c
+++ b/kern/processor.c
@@ -924,7 +924,8 @@ processor_set_things(
thread = (thread_t) queue_next(&thread->pset_threads)) {
/* take ref for convert_thread_to_port */
thread_reference(thread);
- threads[i] = thread;
+ if (threads != (thread_t *)0)
+ threads[i] = thread;
}
assert(queue_end(&pset->threads, (queue_entry_t) thread));
break;
--
1.8.1.4