mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	32bit > 4GB integer overflow edge case fix
This commit is contained in:
		@@ -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))
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user