aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishnuvardhan Prodduturi <vproddut@codeaurora.org>2019-10-21 14:52:59 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2019-10-22 07:14:21 -0700
commite632fb04f7e1a8dbc07954ec0232aed32d6b6db8 (patch)
tree0c16993b5b124be2bbb176fc7d005ebacb6b43dd
parent6b3f84f45b8dd65199cae46cd85fb6e6395e5585 (diff)
disp: msm: dsi: add check before buffer copyLE.UM.4.1.1-02410-sa515m
This change adds a check for the length of the buffer before copying it to avoid a buffer overflow. Change-Id: I146895660be4060d9896706636257a57c6aef94f Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>
-rw-r--r--drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c
index 47e347693452..b09b43342295 100644
--- a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c
+++ b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c
@@ -118,7 +118,7 @@ static ssize_t debugfs_state_info_read(struct file *file,
dsi_ctrl->clk_freq.pix_clk_rate,
dsi_ctrl->clk_freq.esc_clk_rate);
- /* TODO: make sure that this does not exceed 4K */
+ len = min_t(size_t, len, SZ_4K);
if (copy_to_user(buff, buf, len)) {
kfree(buf);
return -EFAULT;
@@ -173,8 +173,7 @@ static ssize_t debugfs_reg_dump_read(struct file *file,
return rc;
}
-
- /* TODO: make sure that this does not exceed 4K */
+ len = min_t(size_t, len, SZ_4K);
if (copy_to_user(buff, buf, len)) {
kfree(buf);
return -EFAULT;