Skip to content

Commit f9c020e

Browse files
kstribrnAmznaggarg
andauthored
Apply suggestions from code review
Comment updates Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
1 parent 48e4166 commit f9c020e

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

MISRA.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ _Ref 11.5.5_
120120
MISRA C-2012 Rule 14.3: Controlling expressions shall not be invariant.
121121

122122
_Ref 14.3_
123-
- The `configMAX_TASK_NAME_LEN` and `taskRESERVED_TASK_NAME_LENGTH` values
123+
- The `configMAX_TASK_NAME_LEN` and `taskRESERVED_TASK_NAME_LENGTH` are
124+
evaluated to constants at compile time and may vary based on the build configuration.
124125
constant at compile time however can vary depending on build configuration.
125126
This condition takes into account the build configuration of the system.
126127

@@ -130,7 +131,9 @@ MISRA C-2012 Rule 18.1: A pointer resulting from arithmetic on a pointer operand
130131
shall address an element of the same array as that pointer operand.
131132

132133
_Ref 18.1_
133-
- The array access is limited to in-bounds values as the null termination
134+
- Array access remains within bounds since either the null terminator in
135+
the IDLE task name will break the loop, or the loop will break normally
136+
if the array size is smaller than the IDLE task name length.
134137
of the IDLE task name results in breaking from the loop. Alternatively, if
135138
the size is smaller than the IDLE task name length, the loop will exit normally.
136139

tasks.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
#endif
158158

159159
#if ( configNUMBER_OF_CORES > 1 )
160-
/* Reserve space for Core ID and null termination */
160+
/* Reserve space for Core ID and null termination. */
161161
#if ( configMAX_TASK_NAME_LEN < 2U )
162162
#error Minimum required task name length is 2. Please increase configMAX_TASK_NAME_LEN.
163163
#endif
@@ -166,7 +166,7 @@
166166
#elif ( configNUMBER_OF_CORES > 9 )
167167
#warning Please increase taskRESERVED_TASK_NAME_LENGTH. 1 character is insufficient to store the core ID.
168168
#else
169-
/* Reserve space for null termination */
169+
/* Reserve space for null termination. */
170170
#if ( configMAX_TASK_NAME_LEN < 1U )
171171
#error Minimum required task name length is 1. Please increase configMAX_TASK_NAME_LEN.
172172
#endif
@@ -3547,12 +3547,12 @@ static BaseType_t prvCreateIdleTasks( void )
35473547
UBaseType_t xIdleTaskNameIndex;
35483548

35493549
/* MISRA Ref 14.3.1 [Configuration dependent invariant] */
3550-
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-143 */
3550+
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-143. */
35513551
/* coverity[misra_c_2012_rule_14_3_violation] */
35523552
for( xIdleTaskNameIndex = 0U; xIdleTaskNameIndex < ( configMAX_TASK_NAME_LEN - taskRESERVED_TASK_NAME_LENGTH ); xIdleTaskNameIndex++ )
35533553
{
35543554
/* MISRA Ref 18.1.1 [Configuration dependent bounds checking] */
3555-
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-181 */
3555+
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/main/MISRA.md#rule-181. */
35563556
/* coverity[misra_c_2012_rule_18_1_violation] */
35573557
cIdleName[ xIdleTaskNameIndex ] = configIDLE_TASK_NAME[ xIdleTaskNameIndex ];
35583558

0 commit comments

Comments
 (0)