Attention is currently required from: Julius Werner, Yidi Lin, Yu-Ping Wu.
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/78800?usp=email )
Change subject: arch/arm64/arch_timer: Fix possible overflow in multiplication
......................................................................
Patch Set 2:
(1 comment)
File src/arch/arm64/arch_timer.c:
https://review.coreboot.org/c/coreboot/+/78800/comment/a71a194a_06da4a16 :
PS2, Line 11: static uint32_t tfreq, mult;
: uint32_t div;
:
: if (tfreq == 0) {
: tfreq = raw_read_cntfrq_el0();
: assert(tfreq > 0)
: mult = 1000000;
: div = gcd(mult, tfreq);
: tfreq /= div;
: mult /= div;
: }
:
: long usecs = (tvalue * mult) / tfreq;
Nice, but why not just cast `tvalue`, and let the compiler figure out the rest? Is that possible?
--
To view, visit
https://review.coreboot.org/c/coreboot/+/78800?usp=email
To unsubscribe, or for help writing mail filters, visit
https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I366667de05392913150414f0fa9058725be71c52
Gerrit-Change-Number: 78800
Gerrit-PatchSet: 2
Gerrit-Owner: Yidi Lin
yidilin@google.com
Gerrit-Reviewer: Arthur Heymans
arthur@aheymans.xyz
Gerrit-Reviewer: Julius Werner
jwerner@chromium.org
Gerrit-Reviewer: Yu-Ping Wu
yupingso@google.com
Gerrit-CC: Paul Menzel
paulepanter@mailbox.org
Gerrit-CC: build bot (Jenkins)
no-reply@coreboot.org
Gerrit-Attention: Julius Werner
jwerner@chromium.org
Gerrit-Attention: Yidi Lin
yidilin@google.com
Gerrit-Attention: Yu-Ping Wu
yupingso@google.com
Gerrit-Comment-Date: Tue, 31 Oct 2023 16:31:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment