Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,19 @@
{
TCB_t * pxNewTCB;

/* uxStackDepth is a word count that gets multiplied by
* sizeof( StackType_t ) below to get a byte count for the stack
* allocation. On targets where configSTACK_DEPTH_TYPE / size_t is
* 32-bit, an oversized uxStackDepth can make that multiplication
* wrap, silently allocating a far smaller stack than requested
* while prvInitialiseNewTask() still initialises the task using
* the original, larger uxStackDepth. Reject that up front and
* treat it the same as any other allocation failure. */
if( ( SIZE_MAX / sizeof( StackType_t ) ) < ( size_t ) uxStackDepth )

Check warning on line 1648 in tasks.c

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this redundant cast.

See more on https://sonarcloud.io/project/issues?id=FreeRTOS_FreeRTOS-Kernel&issues=AaB9IGmU3hjPHIKcsTM2&open=AaB9IGmU3hjPHIKcsTM2&pullRequest=1489
{
pxNewTCB = NULL;
}
else
/* If the stack grows down then allocate the stack then the TCB so the stack
* does not grow into the TCB. Likewise if the stack grows up then allocate
* the TCB then the stack. */
Expand Down