Browse Source

disp: msm: dsi: add check for buffer length before copy

The change adds a check to make sure the length of bytes being
copied don't exceed the size of the destination buffer
causing an overflow.

Change-Id: Ib3ca3705e4179ccda1af11279e96e167baee6a3b
Signed-off-by: Satya Rama Aditya Pinapala <[email protected]>
Satya Rama Aditya Pinapala 6 years ago
parent
commit
aed315f32b
1 changed files with 3 additions and 0 deletions
  1. 3 0
      msm/dsi/dsi_display.c

+ 3 - 0
msm/dsi/dsi_display.c

@@ -1120,6 +1120,9 @@ static ssize_t debugfs_dump_info_read(struct file *file,
 			"\tClock master = %s\n",
 			display->ctrl[display->clk_master_idx].ctrl->name);
 
+	if (len > user_len)
+		len = user_len;
+
 	if (copy_to_user(user_buf, buf, len)) {
 		kfree(buf);
 		return -EFAULT;