mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	drm/amdgpu: fix the warning about the expression (int)size - len
Converting size from size_t to int may overflow. v2: keep reverse xmas tree order (Christian) Signed-off-by: Jesse Zhang <jesse.zhang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
		
							parent
							
								
									029c2b0389
								
							
						
					
					
						commit
						ea686fef54
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -2065,12 +2065,13 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
 | 
			
		|||
	struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
 | 
			
		||||
	char reg_offset[11];
 | 
			
		||||
	uint32_t *new = NULL, *tmp = NULL;
 | 
			
		||||
	int ret, i = 0, len = 0;
 | 
			
		||||
	unsigned int len = 0;
 | 
			
		||||
	int ret, i = 0;
 | 
			
		||||
 | 
			
		||||
	do {
 | 
			
		||||
		memset(reg_offset, 0, 11);
 | 
			
		||||
		if (copy_from_user(reg_offset, buf + len,
 | 
			
		||||
					min(10, ((int)size-len)))) {
 | 
			
		||||
					min(10, (size-len)))) {
 | 
			
		||||
			ret = -EFAULT;
 | 
			
		||||
			goto error_free;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue