|
113 | 113 | #define CONVERT_TO_INTERNAL_INDEX( lIndex ) ( ( lIndex ) - INDEX_OFFSET ) |
114 | 114 |
|
115 | 115 | /** |
116 | | - * @brief Max value that fits in a size_t type. |
| 116 | + * @brief Max value that fits in a uint32_t type. |
117 | 117 | */ |
118 | | - #define mpuSIZE_MAX ( ~( ( size_t ) 0 ) ) |
| 118 | + #define mpuUINT32_MAX ( ~( ( uint32_t ) 0 ) ) |
119 | 119 |
|
120 | 120 | /** |
121 | 121 | * @brief Check if multiplying a and b will result in overflow. |
122 | 122 | */ |
123 | | - #define mpuMULTIPLY_WILL_OVERFLOW( a, b ) ( ( ( a ) > 0 ) && ( ( b ) > ( mpuSIZE_MAX / ( a ) ) ) ) |
| 123 | + #define mpuMULTIPLY_UINT32_WILL_OVERFLOW( a, b ) ( ( ( a ) > 0 ) && ( ( b ) > ( mpuUINT32_MAX / ( a ) ) ) ) |
124 | 124 |
|
125 | 125 | /** |
126 | 126 | * @brief Get the index of a free slot in the kernel object pool. |
|
937 | 937 | UBaseType_t uxReturn = 0; |
938 | 938 | UBaseType_t xIsTaskStatusArrayWriteable = pdFALSE; |
939 | 939 | UBaseType_t xIsTotalRunTimeWriteable = pdFALSE; |
| 940 | + uint32_t ulArraySize = ( uint32_t ) uxArraySize; |
| 941 | + uint32_t ulTaskStatusSize = ( uint32_t ) sizeof( TaskStatus_t ); |
940 | 942 |
|
941 | | - if( mpuMULTIPLY_WILL_OVERFLOW( sizeof( TaskStatus_t ), uxArraySize ) == 0 ) |
| 943 | + if( mpuMULTIPLY_UINT32_WILL_OVERFLOW( ulTaskStatusSize, ulArraySize ) == 0 ) |
942 | 944 | { |
943 | 945 | xIsTaskStatusArrayWriteable = xPortIsAuthorizedToAccessBuffer( pxTaskStatusArray, |
944 | | - sizeof( TaskStatus_t ) * uxArraySize, |
| 946 | + ulTaskStatusSize * ulArraySize, |
945 | 947 | tskMPU_WRITE_PERMISSION ); |
946 | 948 |
|
947 | 949 | if( pulTotalRunTime != NULL ) |
|
954 | 956 | if( ( xIsTaskStatusArrayWriteable == pdTRUE ) && |
955 | 957 | ( ( pulTotalRunTime == NULL ) || ( xIsTotalRunTimeWriteable == pdTRUE ) ) ) |
956 | 958 | { |
957 | | - uxReturn = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime ); |
| 959 | + uxReturn = uxTaskGetSystemState( pxTaskStatusArray, ( UBaseType_t ) ulArraySize, pulTotalRunTime ); |
958 | 960 | } |
959 | 961 | } |
960 | 962 |
|
|
0 commit comments