diff options
| author | Krishna Manikandan <mkrishn@codeaurora.org> | 2017-06-06 15:37:29 +0530 |
|---|---|---|
| committer | Krishna Manikandan <mkrishn@codeaurora.org> | 2017-06-08 10:43:47 +0530 |
| commit | 7eaa60b8e50aae2e983912054d28f45b1eb8080a (patch) | |
| tree | 3758116c98fa5b7a7569d88115cd4a95998c9d19 | |
| parent | 8efb4552d1830d0b6a836949fd105a6a7548d1d0 (diff) | |
fbdev: msm: fix unaligned access problem
debug offset comes from the user and can hold any value which can
cause unaligned access. This change fixes the unaligned access
problem on debug offset by properly aligning it.
Change-Id: Ic61c2651986ea6c98cc7d58e27af3e5fe6e42a88
Signed-off-by: Harsh Sahu <hsahu@codeaurora.org>
Signed-off-by: Krishna Manikandan <mkrishn@codeaurora.org>
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_debug.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/video/fbdev/msm/mdss_debug.c b/drivers/video/fbdev/msm/mdss_debug.c index 8cb6c7157230..230b02061b39 100644 --- a/drivers/video/fbdev/msm/mdss_debug.c +++ b/drivers/video/fbdev/msm/mdss_debug.c @@ -454,6 +454,9 @@ static ssize_t mdss_debug_base_offset_write(struct file *file, sscanf(buf, "%5x %x", &off, &cnt); + if (off % sizeof(u32)) + return -EINVAL; + if (off > dbg->max_offset) return -EINVAL; @@ -526,6 +529,9 @@ static ssize_t mdss_debug_base_reg_write(struct file *file, if (cnt < 2) return -EFAULT; + if (off % sizeof(u32)) + return -EFAULT; + if (off >= dbg->max_offset) return -EFAULT; @@ -571,6 +577,9 @@ static ssize_t mdss_debug_base_reg_read(struct file *file, return -ENOMEM; } + if (dbg->off % sizeof(u32)) + return -EFAULT; + ptr = dbg->base + dbg->off; tot = 0; |
