[rtems commit] score: Avoid NULL pointer access
Sebastian Huber
sebh at rtems.org
Fri Jun 6 06:34:42 UTC 2014
Module: rtems
Branch: master
Commit: be3c257286ad870d8d1a64941cde53fd2d33a633
Changeset: http://git.rtems.org/rtems/commit/?id=be3c257286ad870d8d1a64941cde53fd2d33a633
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Jun 5 11:17:26 2014 +0200
score: Avoid NULL pointer access
Check that the executing thread is not NULL in _Scheduler_Tick(). It
may be NULL in case the processor has an optional scheduler assigned and
the system was not able to start the processor.
---
cpukit/score/include/rtems/score/schedulerimpl.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index e469214..f162ab3 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -282,9 +282,10 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Tick( void )
for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
const Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
const Scheduler_Control *scheduler = _Scheduler_Get_by_CPU( cpu );
+ Thread_Control *executing = cpu->executing;
- if ( scheduler != NULL ) {
- ( *scheduler->Operations.tick )( scheduler, cpu->executing );
+ if ( scheduler != NULL && executing != NULL ) {
+ ( *scheduler->Operations.tick )( scheduler, executing );
}
}
}
More information about the vc
mailing list