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

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/media/common/siano/smsdvb-debugfs.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c
index 73990e469df9..e81b17b599ec 100644
--- a/drivers/media/common/siano/smsdvb-debugfs.c
+++ b/drivers/media/common/siano/smsdvb-debugfs.c
@@ -280,15 +280,14 @@ static __poll_t smsdvb_stats_poll(struct file *file, poll_table *wait)
 	return rc > 0 ? EPOLLIN | EPOLLRDNORM : 0;
 }
 
-static ssize_t smsdvb_stats_read(struct file *file, char __user *user_buf,
-				      size_t nbytes, loff_t *ppos)
+static ssize_t smsdvb_stats_read(struct kiocb *iocb, struct iov_iter *to)
 {
 	int rc = 0, len;
-	struct smsdvb_debugfs *debug_data = file->private_data;
+	struct smsdvb_debugfs *debug_data = iocb->ki_filp->private_data;
 
 	kref_get(&debug_data->refcount);
 
-	if (file->f_flags & O_NONBLOCK) {
+	if (iocb->ki_filp->f_flags & O_NONBLOCK) {
 		rc = smsdvb_stats_wait_read(debug_data);
 		if (!rc) {
 			rc = -EWOULDBLOCK;
@@ -306,14 +305,14 @@ static ssize_t smsdvb_stats_read(struct file *file, char __user *user_buf,
 		goto ret;
 	}
 
-	len = debug_data->stats_count - *ppos;
+	len = debug_data->stats_count - iocb->ki_pos;
 	if (len >= 0)
-		rc = simple_read_from_buffer(user_buf, nbytes, ppos,
-					     debug_data->stats_data, len);
+		rc = simple_copy_to_iter(debug_data->stats_data, &iocb->ki_pos,
+					 len, to);
 	else
 		rc = 0;
 
-	if (*ppos >= debug_data->stats_count) {
+	if (iocb->ki_pos >= debug_data->stats_count) {
 		spin_lock(&debug_data->lock);
 		debug_data->stats_was_read = true;
 		spin_unlock(&debug_data->lock);
@@ -341,7 +340,7 @@ static int smsdvb_stats_release(struct inode *inode, struct file *file)
 static const struct file_operations debugfs_stats_ops = {
 	.open = smsdvb_stats_open,
 	.poll = smsdvb_stats_poll,
-	.read = smsdvb_stats_read,
+	.read_iter = smsdvb_stats_read,
 	.release = smsdvb_stats_release,
 	.llseek = generic_file_llseek,
 };
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ