SECSPERDAY is 86400 which exceeds the limit of a UINT16 which is 65536. Therefore DayRemainder cannot use UINT16. This patch makes it UINT32.
Cc: Ard Biesheuvel <[email protected]> Cc: Jordan Justen <[email protected]> Cc: Laszlo Ersek <[email protected]> Cc: Anthony Perard <[email protected]> Cc: Julien Grall <[email protected]> Signed-off-by: Yuan Yu <[email protected]> --- CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c index 7d28446d4b5c..bf8a5325817f 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c @@ -118,7 +118,7 @@ gmtime ( { struct tm *GmTime; UINT16 DayNo; - UINT16 DayRemainder; + UINT32 DayRemainder; time_t Year; time_t YearNo; UINT16 TotalDays; @@ -136,7 +136,7 @@ gmtime ( ZeroMem ((VOID *)GmTime, (UINTN)sizeof (struct tm)); DayNo = (UINT16)(*timer / SECSPERDAY); - DayRemainder = (UINT16)(*timer % SECSPERDAY); + DayRemainder = (UINT32)(*timer % SECSPERDAY); GmTime->tm_sec = (int)(DayRemainder % SECSPERMIN); GmTime->tm_min = (int)((DayRemainder % SECSPERHOUR) / SECSPERMIN); -- 2.37.3.998.g577e59143f-goog -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#94459): https://edk2.groups.io/g/devel/message/94459 Mute This Topic: https://groups.io/mt/93968063/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
