drm/amdkfd: Fix shift out-of-bounds issue
authorjsg <jsg@openbsd.org>
Thu, 30 Nov 2023 02:35:24 +0000 (02:35 +0000)
committerjsg <jsg@openbsd.org>
Thu, 30 Nov 2023 02:35:24 +0000 (02:35 +0000)
From Jesse Zhang
2806f880379232e789957c2078d612669eb7a69c in linux-6.1.y/6.1.64
282c1d793076c2edac6c3db51b7e8ed2b41d60a5 in mainline linux

sys/dev/pci/drm/amd/amdkfd/kfd_svm.c

index 6281d37..2088125 100644 (file)
@@ -764,7 +764,7 @@ svm_range_apply_attrs(struct kfd_process *p, struct svm_range *prange,
                        prange->flags &= ~attrs[i].value;
                        break;
                case KFD_IOCTL_SVM_ATTR_GRANULARITY:
-                       prange->granularity = attrs[i].value;
+                       prange->granularity = min_t(uint32_t, attrs[i].value, 0x3F);
                        break;
                default:
                        WARN_ONCE(1, "svm_range_check_attrs wasn't called?");