Skip to content

Commit 373580d

Browse files
committed
Fixed issue with integer overflow when converting time units
1 parent 1798c24 commit 373580d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/abstraction/rtos/include/cyabs_rtos.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ extern cy_rtos_error_t cy_rtos_last_error();
167167
* @param[in] entry_function Function pointer which points to the main function for the new thread
168168
* @param[in] name String thread name used for a debugger
169169
* @param[in] stack The buffer to use for the thread stack. This must be aligned to
170-
CY_RTOS_ALIGNMENT with a size of at least CY_RTOS_MIN_STACK_SIZE
170+
* CY_RTOS_ALIGNMENT with a size of at least CY_RTOS_MIN_STACK_SIZE.
171+
* If stack is null, cy_rtos_create_thread will allocate a stack from the heap.
171172
* @param[in] stack_size The size of the thread stack in bytes
172173
* @param[in] priority The priority of the thread. Values are operating system specific, but some
173174
* common priority levels are defined:

targets/TARGET_Cypress/TARGET_PSOC6/psoc6csp/abstraction/rtos/source/COMPONENT_RTX/cyabs_rtos_rtxv5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ cy_rslt_t cy_rtos_get_time(cy_time_t *tval)
803803

804804
/* Convert ticks count to time in milliseconds */
805805
if (tick_freq != 0)
806-
*tval = ((osKernelGetTickCount() * 1000) / tick_freq);
806+
*tval = (cy_time_t)((osKernelGetTickCount() * 1000LL) / tick_freq);
807807
else
808808
status = CY_RTOS_GENERAL_ERROR;
809809
}

0 commit comments

Comments
 (0)