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-362-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:18:21 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 361/437] hwmon: mr75203: convert to read/write iterators

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

diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
index 50a8b9c3f94d..a2de0954b4e6 100644
--- a/drivers/hwmon/mr75203.c
+++ b/drivers/hwmon/mr75203.c
@@ -182,26 +182,24 @@ struct pvt_device {
 	u32			ip_freq;
 };
 
-static ssize_t pvt_ts_coeff_j_read(struct file *file, char __user *user_buf,
-				   size_t count, loff_t *ppos)
+static ssize_t pvt_ts_coeff_j_read(struct kiocb *iocb, struct iov_iter *to)
 {
-	struct pvt_device *pvt = file->private_data;
+	struct pvt_device *pvt = iocb->ki_filp->private_data;
 	unsigned int len;
 	char buf[13];
 
 	len = scnprintf(buf, sizeof(buf), "%d\n", pvt->ts_coeff.j);
 
-	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+	return simple_copy_to_iter(buf, &iocb->ki_pos, len, to);
 }
 
-static ssize_t pvt_ts_coeff_j_write(struct file *file,
-				    const char __user *user_buf,
-				    size_t count, loff_t *ppos)
+static ssize_t pvt_ts_coeff_j_write(struct kiocb *iocb, struct iov_iter *from)
 {
-	struct pvt_device *pvt = file->private_data;
+	struct pvt_device *pvt = iocb->ki_filp->private_data;
+	size_t count = iov_iter_count(from);
 	int ret;
 
-	ret = kstrtos32_from_user(user_buf, count, 0, &pvt->ts_coeff.j);
+	ret = kstrtos32_from_iter(from, count, 0, &pvt->ts_coeff.j);
 	if (ret)
 		return ret;
 
@@ -209,8 +207,8 @@ static ssize_t pvt_ts_coeff_j_write(struct file *file,
 }
 
 static const struct file_operations pvt_ts_coeff_j_fops = {
-	.read = pvt_ts_coeff_j_read,
-	.write = pvt_ts_coeff_j_write,
+	.read_iter = pvt_ts_coeff_j_read,
+	.write_iter = pvt_ts_coeff_j_write,
 	.open = simple_open,
 	.owner = THIS_MODULE,
 	.llseek = default_llseek,
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ