From: jsg Date: Thu, 30 Nov 2023 02:35:24 +0000 (+0000) Subject: drm/amdkfd: Fix shift out-of-bounds issue X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=6a6ae6f6e78e5a1813d991eb6bb65167d4144e5a;p=openbsd drm/amdkfd: Fix shift out-of-bounds issue From Jesse Zhang 2806f880379232e789957c2078d612669eb7a69c in linux-6.1.y/6.1.64 282c1d793076c2edac6c3db51b7e8ed2b41d60a5 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c b/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c index 6281d370bb4..208812512d8 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_svm.c @@ -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?");