mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
The `.mem_total` variable has `uint64_t` type, therefore, when multiplying the number `20971512` by the number `1024` with the suffix `U`, we will not get the expected result of `21,474,828,288`, since the number `20971512` without an explicit type indication has `uint32_t` type. First, multiplication will occur in accordance with the `uint32_t` type; this operation will cause a **type overflow**, and only then will this result be assigned to a `uint64_t` type variable. It's worth adding the `UL` suffix to the number `20971512` to avoid **overflow**. Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE. Author A. Slepykh.