summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_debugfs.c
diff options
context:
space:
mode:
authorRodrigo Vivi2016-08-03 17:22:57 +0200
committerRodrigo Vivi2016-08-05 18:39:47 +0200
commit4e9121e6b4f9fee47e6746bfdb6745951b7a9b20 (patch)
tree2ccca24d811228b3cce05268d0f48f70548decc5 /drivers/gpu/drm/i915/i915_debugfs.c
parentRevert "drm/i915: Track active streams also for DP SST" (diff)
downloadkernel-qcow2-linux-4e9121e6b4f9fee47e6746bfdb6745951b7a9b20.tar.gz
kernel-qcow2-linux-4e9121e6b4f9fee47e6746bfdb6745951b7a9b20.tar.xz
kernel-qcow2-linux-4e9121e6b4f9fee47e6746bfdb6745951b7a9b20.zip
drm/i915: Fix copy_to_user usage for pipe_crc
Copy to user return the number of bytes it couldn't write and zero on success. So any number different than 0 should be considered a fault, not only when it doesn't write the full size. v2: fixed the inverted logic. (Ville) Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 0620a84d00ca..9bd41581b592 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3625,7 +3625,6 @@ i915_pipe_crc_read(struct file *filep, char __user *user_buf, size_t count,
while (n_entries > 0) {
struct intel_pipe_crc_entry *entry =
&pipe_crc->entries[pipe_crc->tail];
- int ret;
if (CIRC_CNT(pipe_crc->head, pipe_crc->tail,
INTEL_PIPE_CRC_ENTRIES_NR) < 1)
@@ -3642,8 +3641,7 @@ i915_pipe_crc_read(struct file *filep, char __user *user_buf, size_t count,
spin_unlock_irq(&pipe_crc->lock);
- ret = copy_to_user(user_buf, buf, PIPE_CRC_LINE_LEN);
- if (ret == PIPE_CRC_LINE_LEN)
+ if (copy_to_user(user_buf, buf, PIPE_CRC_LINE_LEN))
return -EFAULT;
user_buf += PIPE_CRC_LINE_LEN;