summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2019-08-08 09:34:48 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2019-08-08 09:34:48 -0700
commit8b46fe9a3307679168c4e5a29f6fa15303706df9 (patch)
tree0ca8b603fe57a8c89c07f3d00d1e8c7d9dc83d67 /drivers/gpu
parent982ba8be162a4668ab2c2a69b55b9a0e7975f84c (diff)
parent9ddd05897c84e630bf15e8efbe88773c7544a2c0 (diff)
Merge "drm/msm/dsi-staging: Add length check before copying to user space"
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c
index 252a6289881f..75543c768d45 100644
--- a/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c
+++ b/drivers/gpu/drm/msm/dsi-staging/dsi_ctrl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -123,6 +123,9 @@ static ssize_t debugfs_state_info_read(struct file *file,
dsi_ctrl->clk_info.link_clks.pixel_clk_rate,
dsi_ctrl->clk_info.link_clks.esc_clk_rate);
+ if (len > count)
+ len = count;
+
/* TODO: make sure that this does not exceed 4K */
if (copy_to_user(buff, buf, len)) {
kfree(buf);
@@ -162,6 +165,9 @@ static ssize_t debugfs_reg_dump_read(struct file *file,
"Core clocks are not turned on, cannot read\n");
}
+ if (len > count)
+ len = count;
+
/* TODO: make sure that this does not exceed 4K */
if (copy_to_user(buff, buf, len)) {
kfree(buf);