:: commit a5eba5a07386ca25c1834931c55228a6b4cd0715

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

parents: e94185abe5

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