|
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. |
|
1048 | 1048 | UBaseType_t uxReturn = 0; |
1049 | 1049 | UBaseType_t xIsTaskStatusArrayWriteable = pdFALSE; |
1050 | 1050 | UBaseType_t xIsTotalRunTimeWriteable = pdFALSE; |
| 1051 | + uint32_t ulArraySize = ( uint32_t ) uxArraySize; |
| 1052 | + uint32_t ulTaskStatusSize = ( uint32_t ) sizeof( TaskStatus_t ); |
1051 | 1053 |
|
1052 | | - if( mpuMULTIPLY_WILL_OVERFLOW( sizeof( TaskStatus_t ), uxArraySize ) == 0 ) |
| 1054 | + if( mpuMULTIPLY_UINT32_WILL_OVERFLOW( ulTaskStatusSize, ulArraySize ) == 0 ) |
1053 | 1055 | { |
1054 | 1056 | xIsTaskStatusArrayWriteable = xPortIsAuthorizedToAccessBuffer( pxTaskStatusArray, |
1055 | | - sizeof( TaskStatus_t ) * uxArraySize, |
| 1057 | + ulTaskStatusSize * ulArraySize, |
1056 | 1058 | tskMPU_WRITE_PERMISSION ); |
1057 | 1059 |
|
1058 | 1060 | if( pulTotalRunTime != NULL ) |
|
1065 | 1067 | if( ( xIsTaskStatusArrayWriteable == pdTRUE ) && |
1066 | 1068 | ( ( pulTotalRunTime == NULL ) || ( xIsTotalRunTimeWriteable == pdTRUE ) ) ) |
1067 | 1069 | { |
1068 | | - uxReturn = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime ); |
| 1070 | + uxReturn = uxTaskGetSystemState( pxTaskStatusArray, ( UBaseType_t ) ulArraySize, pulTotalRunTime ); |
1069 | 1071 | } |
1070 | 1072 | } |
1071 | 1073 |
|
|
0 commit comments