diff options
author | Vishnuvardhan Prodduturi <vproddut@codeaurora.org> | 2019-10-21 14:52:59 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-10-22 06:46:32 -0700 |
commit | d5fc97d3f40c3372fd6c61051f3970969c2e0c25 (patch) | |
tree | 9ad0fa554d110a750a8b63d9118ec789826cdeae | |
parent | 7dcd777b07857e2fe49ce2009c7e569fa8105f17 (diff) |
disp: msm: dsi: add check before buffer copyLV.AU.0.0.1-15410-gen3meta.0
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.c | 5 |
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; |