[PATCH 01/11] score: Add comments and asserts for clarification

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jan 28 15:27:57 UTC 2021


This fix relates to a Coverity issue (NULL_RETURNS).
---
 cpukit/include/rtems/score/priorityimpl.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/cpukit/include/rtems/score/priorityimpl.h b/cpukit/include/rtems/score/priorityimpl.h
index 1a7f90a065..7a14ec97b8 100644
--- a/cpukit/include/rtems/score/priorityimpl.h
+++ b/cpukit/include/rtems/score/priorityimpl.h
@@ -613,7 +613,9 @@ RTEMS_INLINE_ROUTINE void _Priority_Extract(
   } else {
     Priority_Node *min;
 
+    /* The aggregation is non-empty, so the minimum node exists. */
     min = _Priority_Get_minimum_node( aggregation );
+    _Assert( min != NULL );
 
     if ( node->priority < min->priority ) {
       aggregation->Node.priority = min->priority;
@@ -684,7 +686,12 @@ RTEMS_INLINE_ROUTINE void _Priority_Changed(
 
   _Priority_Plain_changed( aggregation, node );
 
+  /*
+   * There is at least the changed node in the aggregation, so the minimum node
+   * exists.
+   */
   min = _Priority_Get_minimum_node( aggregation );
+  _Assert( min != NULL );
 
   if ( min->priority != aggregation->Node.priority ) {
     aggregation->Node.priority = min->priority;
-- 
2.26.2



More information about the devel mailing list