drm/amdgpu: fix the warning about the expression (int)size - len
authorjsg <jsg@openbsd.org>
Fri, 12 Jul 2024 04:03:31 +0000 (04:03 +0000)
committerjsg <jsg@openbsd.org>
Fri, 12 Jul 2024 04:03:31 +0000 (04:03 +0000)
From Jesse Zhang
3fac5aecb59336c9ae808a2cf4733f9f185e3fa2 in linux-6.6.y/6.6.39
ea686fef5489ef7a2450a9fdbcc732b837fb46a8 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_debugfs.c

index 418ff7c..1c2c9ff 100644 (file)
@@ -2052,12 +2052,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;
                }