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: Rahul Sharma <rahsha@codeaurora.org>
This commit is contained in:
Rahul Sharma 2019-08-02 17:53:22 +05:30
parent fc509761a1
commit 13d43fca0c

View file

@ -78,7 +78,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);