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

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/usb/mon/mon_bin.c  | 3 ++-
 drivers/usb/mon/mon_stat.c | 9 ++++-----
 drivers/usb/mon/mon_text.c | 6 ++++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c
index 4e30de4db1c0..af88dd18eafe 100644
--- a/drivers/usb/mon/mon_bin.c
+++ b/drivers/usb/mon/mon_bin.c
@@ -867,6 +867,7 @@ static ssize_t mon_bin_read(struct file *file, char __user *buf,
 	mutex_unlock(&rp->fetch_lock);
 	return done;
 }
+FOPS_READ_ITER_HELPER(mon_bin_read);
 
 /*
  * Remove at most nevents from chunked buffer.
@@ -1290,7 +1291,7 @@ static const struct file_operations mon_fops_binary = {
 	.owner =	THIS_MODULE,
 	.open =		mon_bin_open,
 	.llseek =	no_llseek,
-	.read =		mon_bin_read,
+	.read_iter =	mon_bin_read_iter,
 	/* .write =	mon_text_write, */
 	.poll =		mon_bin_poll,
 	.unlocked_ioctl = mon_bin_ioctl,
diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c
index 3c23805ab1a4..e13a81ade7cf 100644
--- a/drivers/usb/mon/mon_stat.c
+++ b/drivers/usb/mon/mon_stat.c
@@ -43,12 +43,11 @@ static int mon_stat_open(struct inode *inode, struct file *file)
 	return 0;
 }
 
-static ssize_t mon_stat_read(struct file *file, char __user *buf,
-				size_t nbytes, loff_t *ppos)
+static ssize_t mon_stat_read(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct snap *sp = file->private_data;
+	struct snap *sp = iocb->ki_filp->private_data;
 
-	return simple_read_from_buffer(buf, nbytes, ppos, sp->str, sp->slen);
+	return simple_copy_to_iter(sp->str, &iocb->ki_pos, sp->slen, to);
 }
 
 static int mon_stat_release(struct inode *inode, struct file *file)
@@ -63,7 +62,7 @@ const struct file_operations mon_fops_stat = {
 	.owner =	THIS_MODULE,
 	.open =		mon_stat_open,
 	.llseek =	no_llseek,
-	.read =		mon_stat_read,
+	.read_iter =	mon_stat_read,
 	/* .write =	mon_stat_write, */
 	/* .poll =		mon_stat_poll, */
 	/* .unlocked_ioctl =	mon_stat_ioctl, */
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index 2fe9b95bac1d..ec50a0e23117 100644
--- a/drivers/usb/mon/mon_text.c
+++ b/drivers/usb/mon/mon_text.c
@@ -428,6 +428,7 @@ static ssize_t mon_text_read_t(struct file *file, char __user *buf,
 	mutex_unlock(&rp->printf_lock);
 	return ret;
 }
+FOPS_READ_ITER_HELPER(mon_text_read_t);
 
 /* ppos is not advanced since the llseek operation is not permitted. */
 static ssize_t mon_text_read_u(struct file *file, char __user *buf,
@@ -476,6 +477,7 @@ static ssize_t mon_text_read_u(struct file *file, char __user *buf,
 	mutex_unlock(&rp->printf_lock);
 	return ret;
 }
+FOPS_READ_ITER_HELPER(mon_text_read_u);
 
 static struct mon_event_text *mon_text_read_wait(struct mon_reader_text *rp,
     struct file *file)
@@ -686,7 +688,7 @@ static const struct file_operations mon_fops_text_t = {
 	.owner =	THIS_MODULE,
 	.open =		mon_text_open,
 	.llseek =	no_llseek,
-	.read =		mon_text_read_t,
+	.read_iter =	mon_text_read_t_iter,
 	.release =	mon_text_release,
 };
 
@@ -694,7 +696,7 @@ static const struct file_operations mon_fops_text_u = {
 	.owner =	THIS_MODULE,
 	.open =		mon_text_open,
 	.llseek =	no_llseek,
-	.read =		mon_text_read_u,
+	.read_iter =	mon_text_read_u_iter,
 	.release =	mon_text_release,
 };
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ