[PATCH 16/20] objectimpl.h: Add _Assert() to _Objects_Invalidate_Id()

Joel Sherrill joel.sherrill at oarcorp.com
Tue Nov 25 23:02:44 UTC 2014


From: Josh Oguin <josh.oguin at oarcorp.com>

CodeSonar flagged this as a possible NULL deference. This should never
occur but adding the _Assert() ensures we are guarding against that.
---
 cpukit/score/include/rtems/score/objectimpl.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index 4e626ae..2928eff 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -875,6 +875,9 @@ RTEMS_INLINE_ROUTINE void _Objects_Invalidate_Id(
   Objects_Control      *the_object
 )
 {
+  _Assert( information != NULL );
+  _Assert( the_object != NULL );
+
   _Objects_Set_local_object(
     information,
     _Objects_Get_index( the_object->id ),
@@ -896,6 +899,9 @@ RTEMS_INLINE_ROUTINE void _Objects_Open(
   Objects_Name         name
 )
 {
+  _Assert( information != NULL );
+  _Assert( the_object != NULL );
+
   the_object->name = name;
 
   _Objects_Set_local_object(
-- 
1.9.3




More information about the devel mailing list