lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-402-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:19:01 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 401/437] drivers/gnss: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/gnss/core.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c
index 48f2ee0f78c4..ce66ffb85832 100644
--- a/drivers/gnss/core.c
+++ b/drivers/gnss/core.c
@@ -119,11 +119,12 @@ static ssize_t gnss_read(struct file *file, char __user *buf,
 
 	return ret;
 }
+FOPS_READ_ITER_HELPER(gnss_read);
 
-static ssize_t gnss_write(struct file *file, const char __user *buf,
-				size_t count, loff_t *pos)
+static ssize_t gnss_write(struct kiocb *iocb, struct iov_iter *from)
 {
-	struct gnss_device *gdev = file->private_data;
+	struct gnss_device *gdev = iocb->ki_filp->private_data;
+	size_t count = iov_iter_count(from);
 	size_t written = 0;
 	int ret;
 
@@ -148,7 +149,7 @@ static ssize_t gnss_write(struct file *file, const char __user *buf,
 		if (n > GNSS_WRITE_BUF_SIZE)
 			n = GNSS_WRITE_BUF_SIZE;
 
-		if (copy_from_user(gdev->write_buf, buf, n)) {
+		if (!copy_from_iter_full(gdev->write_buf, n, from)) {
 			ret = -EFAULT;
 			goto out_unlock;
 		}
@@ -170,7 +171,6 @@ static ssize_t gnss_write(struct file *file, const char __user *buf,
 			break;
 
 		written += ret;
-		buf += ret;
 
 		if (written == count)
 			break;
@@ -203,8 +203,8 @@ static const struct file_operations gnss_fops = {
 	.owner		= THIS_MODULE,
 	.open		= gnss_open,
 	.release	= gnss_release,
-	.read		= gnss_read,
-	.write		= gnss_write,
+	.read_iter	= gnss_read_iter,
+	.write_iter	= gnss_write,
 	.poll		= gnss_poll,
 	.llseek		= no_llseek,
 };
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ