From aed315f32b821c379c21716cd8d9074315d6cb97 Mon Sep 17 00:00:00 2001 From: Satya Rama Aditya Pinapala Date: Tue, 11 Jun 2019 11:57:43 -0700 Subject: [PATCH] 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 --- msm/dsi/dsi_display.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 94524c4a79..52e9a0f0bf 100644 --- a/msm/dsi/dsi_display.c +++ b/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;