Merge pull request #97403 from abelbarrera15/mem-32-bit-req-bug

32bit > 4GB integer overflow edge case fix
This commit is contained in:
Kubernetes Prow Robot 2020-12-21 11:06:26 -08:00 committed by GitHub
commit 32093b0447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))
}