Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ee6aab7 authored by Harsh Sahu's avatar Harsh Sahu
Browse files

msm : mdss: 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: default avatarHarsh Sahu <hsahu@codeaurora.org>
parent 7d7aefae
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -416,6 +416,9 @@ static ssize_t mdss_debug_base_offset_write(struct file *file,

	buf[count] = 0;	/* end of string */

	if (off % sizeof(u32))
		return -EINVAL;

	sscanf(buf, "%5x %x", &off, &cnt);

	if (off > dbg->max_offset)
@@ -490,6 +493,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;

@@ -535,6 +541,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;