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

Commit 1b2153e9 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "hsic_sysmon_test: Add check for userspace buffer size count"

parents 509ba7c8 360e898f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -63,9 +63,13 @@ static ssize_t sysmon_test_write(struct file *file, const char __user *ubuf,
	if (!dev)
		return -ENODEV;

	/* Add check for user buf count greater than RD_BUF_SIZE */
	if (count > RD_BUF_SIZE)
		count = RD_BUF_SIZE;

	if (copy_from_user(dev->buf, ubuf, count)) {
		pr_err("error copying for writing");
		return 0;
		return -EFAULT;
	}

	ret = hsic_sysmon_write(id, dev->buf, count, 1000);