Attention is currently required from: Yidi Lin.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/78888?usp=email )
Change subject: libpayload/libc/time: Fix possible overflow in multiplication ......................................................................
Patch Set 11:
(2 comments)
Commit Message:
https://review.coreboot.org/c/coreboot/+/78888/comment/d0e8c8c8_b83baa47 : PS11, Line 11: USECS_PER_SEC and hz can be reduced by dividing them by their GCD. Assuming their GCD is big enough?
https://review.coreboot.org/c/coreboot/+/78888/comment/55d993fb_558fb876 : PS11, Line 15: counter should never be that fast. On Intel it can be that fast (it's usually the processor base frequency).
I've been thinking about alternative implementations that avoid the overflow. Using update_clock() would be easiest. It seems specifically implemented to avoid overflows.
Alternatively, as it seems timer_us() is never used in a context where we need us precision, maybe it could be rounded down or we could even replace it with a ms version.