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

Commit 35b1da4e authored by Axel Lin's avatar Axel Lin Committed by Dmitry Torokhov
Browse files

Input: edt-ft5x06 - return -EFAULT on copy_to_user() error



copy_to_user() returns the number of bytes remaining, but we want a
negative error code here.

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 30ebb7fa
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -566,8 +566,11 @@ static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file,
	}

	read = min_t(size_t, count, tsdata->raw_bufsize - *off);
	error = copy_to_user(buf, tsdata->raw_buffer + *off, read);
	if (!error)
	if (copy_to_user(buf, tsdata->raw_buffer + *off, read)) {
		error = -EFAULT;
		goto out;
	}

	*off += read;
out:
	mutex_unlock(&tsdata->mutex);