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

Commit 30753174 authored by Sankeerth Billakanti's avatar Sankeerth Billakanti Committed by Tatenda Chipeperekwa
Browse files

drm/msm/dp: changes to prevent null pointer dereference



Change the buffer size to fix a possible null pointer access

Change-Id: I457d66e9ebe3902a68367a5f0556cf65b617db93
Signed-off-by: default avatarSankeerth Billakanti <sbillaka@codeaurora.org>
Signed-off-by: default avatarTatenda Chipeperekwa <tatendac@codeaurora.org>
parent 73cc3232
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -747,7 +747,7 @@ static ssize_t dp_debug_write_exe_mode(struct file *file,
		const char __user *user_buff, size_t count, loff_t *ppos)
{
	struct dp_debug_private *debug = file->private_data;
	char *buf;
	char buf[SZ_32];
	size_t len = 0;

	if (!debug)
@@ -757,7 +757,9 @@ static ssize_t dp_debug_write_exe_mode(struct file *file,
		return 0;

	len = min_t(size_t, count, SZ_32 - 1);
	buf = memdup_user(user_buff, len);
	if (copy_from_user(buf, user_buff, len))
		goto end;

	buf[len] = '\0';

	if (sscanf(buf, "%3s", debug->exe_mode) != 1)