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 <ardb+tianoc...@kernel.org> Cc: Jordan Justen <jordan.l.jus...@intel.com> Cc: Laszlo Ersek <ler...@redhat.com> Cc: Anthony Perard <anthony.per...@citrix.com> Cc: Julien Grall <jul...@xen.org> Signed-off-by: Yuan Yu <yua...@google.com> --- 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: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-