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 <psraditya30@codeaurora.org>
This commit is contained in:
Satya Rama Aditya Pinapala 2019-06-11 11:57:43 -07:00
parent a8974603d1
commit aed315f32b

View File

@ -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;