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-289-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:17:08 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 288/437] fs/xfs: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 fs/xfs/scrub/stats.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/fs/xfs/scrub/stats.c b/fs/xfs/scrub/stats.c
index 42cafbed94ac..bd546b61334d 100644
--- a/fs/xfs/scrub/stats.c
+++ b/fs/xfs/scrub/stats.c
@@ -235,12 +235,10 @@ xchk_stats_merge(
 
 static ssize_t
 xchk_scrub_stats_read(
-	struct file		*file,
-	char __user		*ubuf,
-	size_t			count,
-	loff_t			*ppos)
+	struct kiocb		*iocb,
+	struct iov_iter		*to)
 {
-	struct xchk_stats	*cs = file->private_data;
+	struct xchk_stats	*cs = iocb->ki_filp->private_data;
 	char			*buf;
 	size_t			bufsize;
 	ssize_t			avail, ret;
@@ -250,7 +248,7 @@ xchk_scrub_stats_read(
 	 * do not want userspace to receive garbled text from multiple calls.
 	 * If the file position is greater than 0, return a short read.
 	 */
-	if (*ppos > 0)
+	if (iocb->ki_pos > 0)
 		return 0;
 
 	bufsize = xchk_stats_estimate_bufsize(cs);
@@ -265,7 +263,7 @@ xchk_scrub_stats_read(
 		goto out;
 	}
 
-	ret = simple_read_from_buffer(ubuf, count, ppos, buf, avail);
+	ret = simple_copy_to_iter(buf, &iocb->ki_pos, avail, to);
 out:
 	kvfree(buf);
 	return ret;
@@ -273,21 +271,20 @@ xchk_scrub_stats_read(
 
 static const struct file_operations scrub_stats_fops = {
 	.open			= simple_open,
-	.read			= xchk_scrub_stats_read,
+	.read_iter		= xchk_scrub_stats_read,
 };
 
 static ssize_t
 xchk_clear_scrub_stats_write(
-	struct file		*file,
-	const char __user	*ubuf,
-	size_t			count,
-	loff_t			*ppos)
+	struct kiocb 		*iocb,
+	struct iov_iter		*from)
 {
-	struct xchk_stats	*cs = file->private_data;
+	struct xchk_stats	*cs = iocb->ki_filp->private_data;
+	size_t			count = iov_iter_count(from);
 	unsigned int		val;
 	int			ret;
 
-	ret = kstrtouint_from_user(ubuf, count, 0, &val);
+	ret = kstrtouint_from_iter(from, count, 0, &val);
 	if (ret)
 		return ret;
 
@@ -300,7 +297,7 @@ xchk_clear_scrub_stats_write(
 
 static const struct file_operations clear_scrub_stats_fops = {
 	.open			= simple_open,
-	.write			= xchk_clear_scrub_stats_write,
+	.write_iter		= xchk_clear_scrub_stats_write,
 };
 
 /* Initialize the stats object. */
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ