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

Commit 24b18967 authored by Rahul Sharma's avatar Rahul Sharma Committed by Nirmal Abraham
Browse files

drm/msm/hdmi-staging: Fix Buffer Overflow



This change is done to check the size of input before doing the
buffer copy.

Change-Id: I01f8b1f3c3b6e920f186f5f90ea9707bb25bcbbc
Signed-off-by: default avatarRahul Sharma <rahsha@codeaurora.org>
parent d868378e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2017, 2019, The Linux Foundation. All rights reserved.
 * Copyright (C) 2013 Red Hat
 * Author: Rob Clark <robdclark@gmail.com>
 *
@@ -73,7 +73,12 @@ static ssize_t _sde_hdmi_debugfs_dump_info_read(struct file *file,
	if (!buf)
		return -ENOMEM;

	len += snprintf(buf, SZ_4K, "name = %s\n", display->name);
	len += snprintf(buf, SZ_1K, "name = %s\n", display->name);

	if (len > count) {
		kfree(buf);
		return -ENOMEM;
	}

	if (copy_to_user(buff, buf, len)) {
		kfree(buf);