fix: Add missing macro guards in task.h (#1342)

- Add missing conditions to prevent unintended access to
  certain APIs in task.h
- The condition is mentioned in the API description but was
  absent in the code
This commit is contained in:
Harsh Soni 2025-12-29 23:37:57 +05:30 committed by GitHub
parent 3ace38969b
commit 14b30f209f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -602,12 +602,12 @@ typedef enum
* \defgroup xTaskCreateRestricted xTaskCreateRestricted * \defgroup xTaskCreateRestricted xTaskCreateRestricted
* \ingroup Tasks * \ingroup Tasks
*/ */
#if ( portUSING_MPU_WRAPPERS == 1 ) #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition,
TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION; TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
#endif #endif
#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
BaseType_t xTaskCreateRestrictedAffinitySet( const TaskParameters_t * const pxTaskDefinition, BaseType_t xTaskCreateRestrictedAffinitySet( const TaskParameters_t * const pxTaskDefinition,
UBaseType_t uxCoreAffinityMask, UBaseType_t uxCoreAffinityMask,
TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION; TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;