1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Kernel: Fix undefined signed overflow in KernelRng's RTC fallback

This commit is contained in:
Jean-Baptiste Boric 2021-02-11 19:26:00 +01:00 committed by Andreas Kling
parent eedb6480df
commit f8c352a022

View file

@ -77,11 +77,11 @@ KernelRng::KernelRng()
} else {
// Fallback to RTC
klog() << "KernelRng: Using RTC as entropy source (bad!)";
time_t current_time = RTC::now();
auto current_time = static_cast<u64>(RTC::now());
for (size_t i = 0; i < resource().pool_count * resource().reseed_threshold; ++i) {
this->resource().add_random_event(current_time, i % 32);
current_time *= 0x574a;
current_time += 0x40b2;
current_time *= 0x574au;
current_time += 0x40b2u;
}
}
}