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

Commit 9f0dc12e authored by Nirmal Abraham's avatar Nirmal Abraham Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm/dsi-staging: Add range check in debugfs_dump_info_read



Add a check to make sure that the length of bytes copied
to the destination buffer doesn't exceed the requested
buffer length before calling the copy_to_user to avoid
buffer overflow.

Change-Id: Icd65b9be2791a8a487dfc8d7461aadce61de3f1b
Signed-off-by: default avatarNirmal Abraham <nabrah@codeaurora.org>
parent 3ebf72a4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1147,6 +1147,9 @@ static ssize_t debugfs_dump_info_read(struct file *file,
			"\tClock master = %s\n",
			display->ctrl[display->clk_master_idx].ctrl->name);

	if (len > user_len)
		len = user_len;

	if (copy_to_user(user_buf, buf, len)) {
		kfree(buf);
		return -EFAULT;