drm/ttm: Quick-test mmap offset in ttm_bo_mmap()
A BO's address has to be at least the minimum offset. Sharing this test in ttm_bo_mmap() removes code from drivers. A full buffer-address validation is still done within drm_vma_offset_lockup_locked(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:

کامیت شده توسط
Alex Deucher

والد
7d1500f9fb
کامیت
bed2dd8421
@@ -344,13 +344,8 @@ int mgag200_bo_push_sysram(struct mgag200_bo *bo)
|
||||
|
||||
int mgag200_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_file *file_priv;
|
||||
struct mga_device *mdev;
|
||||
struct drm_file *file_priv = filp->private_data;
|
||||
struct mga_device *mdev = file_priv->minor->dev->dev_private;
|
||||
|
||||
if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
|
||||
return -EINVAL;
|
||||
|
||||
file_priv = filp->private_data;
|
||||
mdev = file_priv->minor->dev->dev_private;
|
||||
return ttm_bo_mmap(filp, vma, &mdev->ttm.bdev);
|
||||
}
|
||||
|
مرجع در شماره جدید
Block a user