[PATCH 2/4] score: Add validation that no extensions are null.
Jennifer Averett
jennifer.averett at oarcorp.com
Fri Apr 18 15:02:39 UTC 2014
Verification that rtems_extensions_table did not have null
entries.
---
cpukit/score/Makefile.am | 3 ++-
cpukit/score/include/rtems/score/userextimpl.h | 14 ++++++++++++++
cpukit/score/src/userextaddset.c | 3 +++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index ae92550..6008612 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -327,7 +327,8 @@ libscore_a_SOURCES += src/watchdog.c src/watchdogadjust.c \
## USEREXT_C_FILES
libscore_a_SOURCES += src/userextaddset.c \
- src/userext.c src/userextremoveset.c src/userextiterate.c
+ src/userext.c src/userextremoveset.c src/userextiterate.c \
+ src/userextisvalid.c
## STD_C_FILES
libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
diff --git a/cpukit/score/include/rtems/score/userextimpl.h b/cpukit/score/include/rtems/score/userextimpl.h
index 04808e1..91c5832 100644
--- a/cpukit/score/include/rtems/score/userextimpl.h
+++ b/cpukit/score/include/rtems/score/userextimpl.h
@@ -77,6 +77,20 @@ void _User_extensions_Remove_set(
);
/**
+ * @brief User extension is valid
+ *
+ * This method validates that none of the methods
+ * in the extension are NULL.
+ *
+ * @param[in] extension The extension to validate
+ */
+
+bool _User_extensions_Is_valid(
+ const User_extensions_Table *extension_table
+);
+
+
+/**
* @brief User extension visitor.
*
* @param[in, out] executing The currently executing thread.
diff --git a/cpukit/score/src/userextaddset.c b/cpukit/score/src/userextaddset.c
index a55dd8c..df04e9c 100644
--- a/cpukit/score/src/userextaddset.c
+++ b/cpukit/score/src/userextaddset.c
@@ -26,6 +26,9 @@ void _User_extensions_Add_set(
User_extensions_Control *the_extension
)
{
+
+ _Assert( !_User_extensions_Is_valid(the_extension) );
+
_Chain_Append( &_User_extensions_List, &the_extension->Node );
/*
--
1.8.1.4
More information about the devel
mailing list