Skip to content

Commit ea686fe

Browse files
Jie1zhangalexdeucher
authored andcommitted
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 <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 029c2b0 commit ea686fe

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,12 +2065,13 @@ static ssize_t amdgpu_reset_dump_register_list_write(struct file *f,
20652065
struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
20662066
char reg_offset[11];
20672067
uint32_t *new = NULL, *tmp = NULL;
2068-
int ret, i = 0, len = 0;
2068+
unsigned int len = 0;
2069+
int ret, i = 0;
20692070

20702071
do {
20712072
memset(reg_offset, 0, 11);
20722073
if (copy_from_user(reg_offset, buf + len,
2073-
min(10, ((int)size-len)))) {
2074+
min(10, (size-len)))) {
20742075
ret = -EFAULT;
20752076
goto error_free;
20762077
}

0 commit comments

Comments
 (0)