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-413-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:19:12 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 412/437] hv: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/hv/hv_utils_transport.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/hv/hv_utils_transport.c b/drivers/hv/hv_utils_transport.c
index 832885198643..fa93ac3800ae 100644
--- a/drivers/hv/hv_utils_transport.c
+++ b/drivers/hv/hv_utils_transport.c
@@ -24,13 +24,13 @@ static void hvt_reset(struct hvutil_transport *hvt)
 		hvt->on_reset();
 }
 
-static ssize_t hvt_op_read(struct file *file, char __user *buf,
-			   size_t count, loff_t *ppos)
+static ssize_t hvt_op_read(struct kiocb *iocb, struct iov_iter *to)
 {
+	size_t count = iov_iter_count(to);
 	struct hvutil_transport *hvt;
 	int ret;
 
-	hvt = container_of(file->f_op, struct hvutil_transport, fops);
+	hvt = container_of(iocb->ki_filp->f_op, struct hvutil_transport, fops);
 
 	if (wait_event_interruptible(hvt->outmsg_q, hvt->outmsg_len > 0 ||
 				     hvt->mode != HVUTIL_TRANSPORT_CHARDEV))
@@ -53,7 +53,7 @@ static ssize_t hvt_op_read(struct file *file, char __user *buf,
 		goto out_unlock;
 	}
 
-	if (!copy_to_user(buf, hvt->outmsg, hvt->outmsg_len))
+	if (copy_to_iter_full(hvt->outmsg, hvt->outmsg_len, to))
 		ret = hvt->outmsg_len;
 	else
 		ret = -EFAULT;
@@ -71,16 +71,16 @@ static ssize_t hvt_op_read(struct file *file, char __user *buf,
 	return ret;
 }
 
-static ssize_t hvt_op_write(struct file *file, const char __user *buf,
-			    size_t count, loff_t *ppos)
+static ssize_t hvt_op_write(struct kiocb *iocb, struct iov_iter *from)
 {
+	size_t count = iov_iter_count(from);
 	struct hvutil_transport *hvt;
 	u8 *inmsg;
 	int ret;
 
-	hvt = container_of(file->f_op, struct hvutil_transport, fops);
+	hvt = container_of(iocb->ki_filp->f_op, struct hvutil_transport, fops);
 
-	inmsg = memdup_user(buf, count);
+	inmsg = iterdup(from, count);
 	if (IS_ERR(inmsg))
 		return PTR_ERR(inmsg);
 
@@ -285,8 +285,8 @@ struct hvutil_transport *hvutil_transport_init(const char *name,
 	hvt->mdev.name = name;
 
 	hvt->fops.owner = THIS_MODULE;
-	hvt->fops.read = hvt_op_read;
-	hvt->fops.write = hvt_op_write;
+	hvt->fops.read_iter = hvt_op_read;
+	hvt->fops.write_iter = hvt_op_write;
 	hvt->fops.poll = hvt_op_poll;
 	hvt->fops.open = hvt_op_open;
 	hvt->fops.release = hvt_op_release;
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ