diff options
author | Dave Airlie <airlied@linux.ie> | 2006-12-19 21:48:18 +1100 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2006-12-19 21:48:18 +1100 |
commit | 7458909beae274198ca2a29b510a808ce2feca0a (patch) | |
tree | aafe693e026879402e0cfda385f46276d70a77c7 | |
parent | 98799f862e58e02ef07f0d0db0863e7c91c7e5b0 (diff) |
fixup i915 return values from kernel
-rw-r--r-- | shared-core/i915_dma.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/shared-core/i915_dma.c b/shared-core/i915_dma.c index 60e3e945..3373f1b0 100644 --- a/shared-core/i915_dma.c +++ b/shared-core/i915_dma.c @@ -263,7 +263,7 @@ static int i915_dma_init(DRM_IOCTL_ARGS) retcode = i915_dma_resume(dev); break; default: - retcode = -EINVAL; + retcode = DRM_ERR(EINVAL); break; } @@ -360,10 +360,9 @@ static int i915_emit_cmds(drm_device_t * dev, int __user * buffer, int dwords) for (i = 0; i < dwords;) { int cmd, sz; - if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) { - + if (DRM_COPY_FROM_USER_UNCHECKED(&cmd, &buffer[i], sizeof(cmd))) return DRM_ERR(EINVAL); - } + if ((sz = validate_cmd(cmd)) == 0 || i + sz > dwords) return DRM_ERR(EINVAL); @@ -395,7 +394,7 @@ static int i915_emit_box(drm_device_t * dev, RING_LOCALS; if (DRM_COPY_FROM_USER_UNCHECKED(&box, &boxes[i], sizeof(box))) { - return EFAULT; + return DRM_ERR(EFAULT); } if (box.y2 <= box.y1 || box.x2 <= box.x1 || box.y2 <= 0 || box.x2 <= 0) { |