summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/bochs/bochs_mm.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2019-02-07 09:59:30 +0100
committerAlex Deucher <alexander.deucher@amd.com>2019-03-19 15:03:53 -0500
commitbed2dd84212eb0151ae3bfc39cdaa25a951749c1 (patch)
treeda3155580e0fa7b603bb4fbdb163fcdf497f5ffd /drivers/gpu/drm/bochs/bochs_mm.c
parent7d1500f9fbfc78e6a34be3f8f4b5ba13e8227199 (diff)
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>
Diffstat (limited to 'drivers/gpu/drm/bochs/bochs_mm.c')
-rw-r--r--drivers/gpu/drm/bochs/bochs_mm.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/gpu/drm/bochs/bochs_mm.c b/drivers/gpu/drm/bochs/bochs_mm.c
index ebc9dbd94923..4a40308169c4 100644
--- a/drivers/gpu/drm/bochs/bochs_mm.c
+++ b/drivers/gpu/drm/bochs/bochs_mm.c
@@ -263,14 +263,9 @@ int bochs_bo_unpin(struct bochs_bo *bo)
int bochs_mmap(struct file *filp, struct vm_area_struct *vma)
{
- struct drm_file *file_priv;
- struct bochs_device *bochs;
+ struct drm_file *file_priv = filp->private_data;
+ struct bochs_device *bochs = file_priv->minor->dev->dev_private;
- if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
- return -EINVAL;
-
- file_priv = filp->private_data;
- bochs = file_priv->minor->dev->dev_private;
return ttm_bo_mmap(filp, vma, &bochs->ttm.bdev);
}