diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-11-18 13:25:49 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-31 08:29:42 +0200 |
commit | 7552e77c961d2db821e8426fc8f94e5c147b72b7 (patch) | |
tree | be804a4ef3782c2a87f1394f653cf1707ea05bc5 /cpukit/score/src/threadqextractwithproxy.c | |
parent | score: Add per-CPU state function (diff) | |
download | rtems-7552e77c961d2db821e8426fc8f94e5c147b72b7.tar.bz2 |
score: PR2151: _Thread_queue_Extract_with_proxy()
Avoid NULL pointer access.
Diffstat (limited to 'cpukit/score/src/threadqextractwithproxy.c')
-rw-r--r-- | cpukit/score/src/threadqextractwithproxy.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/cpukit/score/src/threadqextractwithproxy.c b/cpukit/score/src/threadqextractwithproxy.c index a0bf5b3045..f1c194952f 100644 --- a/cpukit/score/src/threadqextractwithproxy.c +++ b/cpukit/score/src/threadqextractwithproxy.c @@ -31,28 +31,29 @@ bool _Thread_queue_Extract_with_proxy( Thread_Control *the_thread ) { - States_Control state; - - state = the_thread->current_state; - - if ( _States_Is_waiting_on_thread_queue( state ) ) { - #if defined(RTEMS_MULTIPROCESSING) - if ( _States_Is_waiting_for_rpc_reply( state ) && - _States_Is_locally_blocked( state ) ) { - Objects_Information *the_information; - Objects_Thread_queue_Extract_callout proxy_extract_callout; - - the_information = _Objects_Get_information_id( the_thread->Wait.id ); - proxy_extract_callout = - (Objects_Thread_queue_Extract_callout) the_information->extract; - - if ( proxy_extract_callout ) - (*proxy_extract_callout)( the_thread ); - } - #endif - _Thread_queue_Extract( the_thread->Wait.queue, the_thread ); - - return true; + Thread_queue_Control *the_thread_queue; + + #if defined(RTEMS_MULTIPROCESSING) + States_Control state; + + state = the_thread->current_state; + if ( _States_Is_waiting_for_rpc_reply( state ) && + _States_Is_locally_blocked( state ) ) { + Objects_Information *the_information; + Objects_Thread_queue_Extract_callout proxy_extract_callout; + + the_information = _Objects_Get_information_id( the_thread->Wait.id ); + proxy_extract_callout = the_information->extract; + + if ( proxy_extract_callout != NULL ) + (*proxy_extract_callout)( the_thread ); + } + #endif + + the_thread_queue = the_thread->Wait.queue; + if ( the_thread_queue != NULL ) { + return _Thread_queue_Extract( the_thread_queue, the_thread ); + } else { + return false; } - return false; } |