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

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

diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
index 27afbb9d544b..de1628737808 100644
--- a/drivers/rapidio/devices/rio_mport_cdev.c
+++ b/drivers/rapidio/devices/rio_mport_cdev.c
@@ -2297,12 +2297,13 @@ static ssize_t mport_read(struct file *filp, char __user *buf, size_t count,
 
 	return ret;
 }
+FOPS_READ_ITER_HELPER(mport_read);
 
-static ssize_t mport_write(struct file *filp, const char __user *buf,
-			 size_t count, loff_t *ppos)
+static ssize_t mport_write(struct kiocb *iocb, struct iov_iter *from)
 {
-	struct mport_cdev_priv *priv = filp->private_data;
+	struct mport_cdev_priv *priv = iocb->ki_filp->private_data;
 	struct rio_mport *mport = priv->md->mport;
+	size_t count = iov_iter_count(from);
 	struct rio_event event;
 	int len, ret;
 
@@ -2314,7 +2315,7 @@ static ssize_t mport_write(struct file *filp, const char __user *buf,
 
 	len = 0;
 	while ((count - len) >= (int)sizeof(event)) {
-		if (copy_from_user(&event, buf, sizeof(event)))
+		if (!copy_from_iter_full(&event,sizeof(event), from))
 			return -EFAULT;
 
 		if (event.header != RIO_DOORBELL)
@@ -2327,7 +2328,6 @@ static ssize_t mport_write(struct file *filp, const char __user *buf,
 			return ret;
 
 		len += sizeof(event);
-		buf += sizeof(event);
 	}
 
 	return len;
@@ -2338,8 +2338,8 @@ static const struct file_operations mport_fops = {
 	.open		= mport_cdev_open,
 	.release	= mport_cdev_release,
 	.poll		= mport_cdev_poll,
-	.read		= mport_read,
-	.write		= mport_write,
+	.read_iter	= mport_read_iter,
+	.write_iter	= mport_write,
 	.mmap		= mport_cdev_mmap,
 	.fasync		= mport_cdev_fasync,
 	.unlocked_ioctl = mport_cdev_ioctl
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ