mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
32bit > 4GB integer overflow edge case fix
This commit is contained in:
parent
b749a3a421
commit
52979da973
@ -51,8 +51,8 @@ func (mc MemCheck) Check() (warnings, errorList []error) {
|
||||
errorList = append(errorList, errors.Wrapf(err, "failed to get system info"))
|
||||
}
|
||||
|
||||
// Totalram returns bytes; convert to MB
|
||||
actual := uint64(info.Totalram) / 1024 / 1024
|
||||
// Totalram holds the total usable memory. Unit holds the size of a memory unit in bytes. Multiply them and convert to MB
|
||||
actual := uint64(info.Totalram) * uint64(info.Unit) / 1024 / 1024
|
||||
if actual < mc.Mem {
|
||||
errorList = append(errorList, errors.Errorf("the system RAM (%d MB) is less than the minimum %d MB", actual, mc.Mem))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user