:: commit 9ff880b13e5b93319fe1592361cc3118687128f4

Mintsuki <mintsuki@protonmail.com> — 2026-02-08 06:26

parents: 50b395bf02

sys/cpu: Fix 32-bit multiplication overflow in tsc_freq_arch

diff --git a/common/sys/cpu.h b/common/sys/cpu.h
index 2b5ba3c2..3534b121 100644
--- a/common/sys/cpu.h
+++ b/common/sys/cpu.h
@@ -167,7 +167,7 @@ static inline uint64_t tsc_freq_arch(void) {
         return 0;
     if (eax == 0 || ebx == 0 || ecx == 0)
         return 0;
-    return ecx * ebx / eax;
+    return (uint64_t)ecx * ebx / eax;
 }
 
 #define rdrand(type) ({ \
tab: 248 wrap: offon