drm/i915: Fix copy_to_user usage for pipe_crc
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): Message-ID: <[email protected]
Rodrigo Vivi
maintainerPATCH 1/1 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ä <[email protected]>
Reviewed-by Daniel Vetter <[email protected]>
Signed-off-by Rodrigo Vivi <[email protected]>
--- drivers/gpu/drm/i915/i915_debugfs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +1 -3
@@ -3632,7 +3632,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 )
@@ -3649,8 +3648,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 ;
Signature · 6 lines
2.5.5 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx