Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32291 )
Change subject: nb/via/vx900: Use 64 bits to prevent overflow ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/#/c/32291/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/32291/1//COMMIT_MSG@9 PS1, Line 9: The bit operations are currently done using 32 bit math. : Cast the first argument to 64 bits to prevent possible : overflow.
Does this fix anything? If the 32 bit math overflows you'd certainly still have problems with that c […]
What we currently have is
64 bit variable = 32 bit variable << 10
The problem is that the bit shift is done using a 32 bit intermediate value (which could overflow) and is then extended to 64 bits. The cast forces a 64 bit intermediate value to be used, which will always have enough space to hold the computation.