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

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/mfd/aat2870-core.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
index 2fee62f1016c..78a8809908ff 100644
--- a/drivers/mfd/aat2870-core.c
+++ b/drivers/mfd/aat2870-core.c
@@ -248,10 +248,9 @@ static ssize_t aat2870_dump_reg(struct aat2870_data *aat2870, char *buf)
 	return count;
 }
 
-static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf,
-				     size_t count, loff_t *ppos)
+static ssize_t aat2870_reg_read_file(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct aat2870_data *aat2870 = file->private_data;
+	struct aat2870_data *aat2870 = iocb->ki_filp->private_data;
 	char *buf;
 	ssize_t ret;
 
@@ -261,18 +260,17 @@ static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf,
 
 	ret = aat2870_dump_reg(aat2870, buf);
 	if (ret >= 0)
-		ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret);
+		ret = simple_copy_from_iter(buf, &iocb->ki_pos, ret, to);
 
 	kfree(buf);
 
 	return ret;
 }
 
-static ssize_t aat2870_reg_write_file(struct file *file,
-				      const char __user *user_buf, size_t count,
-				      loff_t *ppos)
+static ssize_t aat2870_reg_write_file(struct kiocb *iocb, struct iov_iter *from)
 {
-	struct aat2870_data *aat2870 = file->private_data;
+	struct aat2870_data *aat2870 = iocb->ki_filp->private_data;
+	size_t count = iov_iter_count(from);
 	char buf[32];
 	ssize_t buf_size;
 	char *start = buf;
@@ -280,7 +278,7 @@ static ssize_t aat2870_reg_write_file(struct file *file,
 	int ret;
 
 	buf_size = min(count, (size_t)(sizeof(buf)-1));
-	if (copy_from_user(buf, user_buf, buf_size)) {
+	if (!copy_from_iter_full(buf, buf_size, from)) {
 		dev_err(aat2870->dev, "Failed to copy from user\n");
 		return -EFAULT;
 	}
@@ -314,8 +312,8 @@ static ssize_t aat2870_reg_write_file(struct file *file,
 
 static const struct file_operations aat2870_reg_fops = {
 	.open = simple_open,
-	.read = aat2870_reg_read_file,
-	.write = aat2870_reg_write_file,
+	.read_iter = aat2870_reg_read_file,
+	.write_iter = aat2870_reg_write_file,
 };
 
 static void aat2870_init_debugfs(struct aat2870_data *aat2870)
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ