coreboot-kgpe-d16/payloads/libpayload/libc
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
..
Makefile.inc libpayload/libc/getopt_long: Use common GCD 2023-11-04 17:09:36 +00:00
args.c
console.c
coreboot.c libpayload: Add parsing of SMBIOS address 2023-08-17 15:48:56 +00:00
ctype.c
die.c
exec.c
fmap.c
fpmath.c
getopt_long.c libpayload/libc/getopt_long: Use common GCD 2023-11-04 17:09:36 +00:00
hexdump.c
ipchecksum.c
lib.c libpayload: Add vboot and reboot utility functions 2023-09-18 15:42:31 +00:00
libgcc.c
lp_vboot.c libpayload: Add vboot and reboot utility functions 2023-09-18 15:42:31 +00:00
malloc.c libpayload: Fix untyped function arguments 2023-08-26 21:01:43 +00:00
memory.c
printf.c libpayload: Fix clang fallthrough warning 2023-08-28 02:12:25 +00:00
qsort.c
rand.c
readline.c
string.c libpayload/string: add strndup() function 2023-02-16 17:54:51 +00:00
strlcpy.c
sysinfo.c
time.c libpayload/libc/time: Fix possible overflow in multiplication 2023-11-07 19:25:23 +00:00