From b1ac7d2a72d31d33402aee514f4d1908ca9dc07c Mon Sep 17 00:00:00 2001 From: Owain Ainsworth Date: Sun, 5 Apr 2009 00:32:55 +0000 Subject: kill DRM_VERIFYAREA_READ, it's part of a linux optimisation where we can guarrantee that copyin won't pagefault and use a faster version in that case. Since we just use plain copyin, it's stupid. --- sys/dev/pci/drm/i915_dma.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'sys/dev/pci/drm/i915_dma.c') diff --git a/sys/dev/pci/drm/i915_dma.c b/sys/dev/pci/drm/i915_dma.c index f426c493e6c..0133277d755 100644 --- a/sys/dev/pci/drm/i915_dma.c +++ b/sys/dev/pci/drm/i915_dma.c @@ -274,7 +274,7 @@ static int i915_emit_cmds(struct drm_device *dev, int __user *buffer, for (i = 0; i < dwords;) { int cmd, sz; - if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) + if (DRM_COPY_FROM_USER(&cmd, &buffer[i], sizeof(cmd))) return EINVAL; if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) @@ -283,8 +283,7 @@ static int i915_emit_cmds(struct drm_device *dev, int __user *buffer, OUT_RING(cmd); while (++i, --sz) { - if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], - sizeof(cmd))) { + if (DRM_COPY_FROM_USER(&cmd, &buffer[i], sizeof(cmd))) { return EINVAL; } OUT_RING(cmd); @@ -299,20 +298,21 @@ static int i915_emit_cmds(struct drm_device *dev, int __user *buffer, return 0; } -static int i915_emit_box(struct drm_device * dev, - struct drm_clip_rect __user * boxes, - int i, int DR1, int DR4) +static int +i915_emit_box(struct drm_device * dev, struct drm_clip_rect *boxes, + int i, int DR1, int DR4) { drm_i915_private_t *dev_priv = dev->dev_private; struct drm_clip_rect box; - if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) { + if (DRM_COPY_FROM_USER(&box, &boxes[i], sizeof(box))) { return EFAULT; } - if (box.y2 <= box.y1 || box.x2 <= box.x1 || box.y2 <= 0 || box.x2 <= 0) { + if (box.y2 <= box.y1 || box.x2 <= box.x1 || box.y2 <= 0 || + box.x2 <= 0) { DRM_ERROR("Bad box %d,%d..%d,%d\n", - box.x1, box.y1, box.x2, box.y2); + box.x1, box.y1, box.x2, box.y2); return EINVAL; } @@ -480,10 +480,6 @@ int i915_batchbuffer(struct drm_device *dev, void *data, LOCK_TEST_WITH_RETURN(dev, file_priv); - if (batch->num_cliprects && DRM_VERIFYAREA_READ(batch->cliprects, - batch->num_cliprects * sizeof(struct drm_clip_rect))) - return EFAULT; - DRM_LOCK(); ret = i915_dispatch_batchbuffer(dev, batch); DRM_UNLOCK(); @@ -508,14 +504,6 @@ int i915_cmdbuffer(struct drm_device *dev, void *data, LOCK_TEST_WITH_RETURN(dev, file_priv); - if (cmdbuf->num_cliprects && - DRM_VERIFYAREA_READ(cmdbuf->cliprects, - cmdbuf->num_cliprects * - sizeof(struct drm_clip_rect))) { - DRM_ERROR("Fault accessing cliprects\n"); - return EFAULT; - } - DRM_LOCK(); ret = i915_dispatch_cmdbuffer(dev, cmdbuf); DRM_UNLOCK(); -- cgit v1.2.3