_Timecounter_Time_uptime: Change from int32_t to time_t

Using int32_t results in an overflow in Y2038. This was
detected by Covered as  CIDs 1512549 and 1512552.

Closes #5204
This commit is contained in:
Joel Sherrill
2025-02-06 16:54:58 -06:00
committed by Gedare Bloom
parent 91237f06f9
commit ec8fa5fc6d
3 changed files with 3 additions and 4 deletions

View File

@@ -43,7 +43,7 @@
__BEGIN_DECLS
extern volatile time_t _Timecounter_Time_second;
extern volatile int32_t _Timecounter_Time_uptime;
extern volatile time_t _Timecounter_Time_uptime;
extern struct bintime _Timecounter_Boottimebin;
void _Timecounter_Binuptime(struct bintime *);

View File

@@ -256,7 +256,7 @@ extern volatile time_t _Timecounter_Time_second;
* For compatibility with the FreeBSD network stack the initial value is one
* second.
*/
extern volatile int32_t _Timecounter_Time_uptime;
extern volatile time_t _Timecounter_Time_uptime;
/**
* @brief The current timecounter.

View File

@@ -282,11 +282,10 @@ struct timecounter *timecounter = &dummy_timecounter;
#ifndef __rtems__
volatile time_t time_second = 1;
volatile time_t time_uptime = 1;
#else /* __rtems__ */
volatile time_t time_second = TOD_SECONDS_1970_THROUGH_1988;
volatile int32_t time_uptime = 1;
#endif /* __rtems__ */
volatile time_t time_uptime = 1;
#ifndef __rtems__
/*