coreboot-kgpe-d16/payloads
Yidi Lin eabdd0252a libpayload/libc/time: Fix possible overflow in multiplication
The value from raw_read_cntfrq_el0() could be large enough to cause
overflow when multiplied by USECS_PER_SEC. To prevent this, both
USECS_PER_SEC and hz can be reduced by dividing them by their GCD.

This patch also modifies the return type of `timer_hz()` from
`uint64_t` to `uint32_t`, assuming that in practice the timestamp
counter should never be that fast.

BUG=b:307790895
TEST=boot to kernel and check the timestamps from `cbmem`

Change-Id: Ia55532490651fcf47128b83a8554751f050bcc89
Signed-off-by: Yidi Lin <yidilin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78888
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2023-11-07 19:25:23 +00:00
..
coreinfo payloads/coreinfo: Use C99 flexible arrays 2023-08-01 12:40:59 +00:00
external payloads/ipxe/Makefile: Use sed more properly 2023-11-06 02:58:33 +00:00
libpayload libpayload/libc/time: Fix possible overflow in multiplication 2023-11-07 19:25:23 +00:00
linuxcheck
nvramcui payloads/nvramcui/nvramcui.c: Reformat code 2022-05-16 02:49:50 +00:00
Kconfig payloads: Make PAYLOAD_NONE a bool outside of the choice 2022-11-04 13:44:59 +00:00
Makefile.inc payloads/Yabits: Remove deprecated Yabits Payload 2023-02-17 01:21:43 +00:00