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

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 block/blk-mq-debugfs.c | 20 ++++++++++----------
 block/blk-mq-debugfs.h |  2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 94668e72ab09..a9fa3d7311ac 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -119,9 +119,10 @@ static int queue_state_show(void *data, struct seq_file *m)
 	return 0;
 }
 
-static ssize_t queue_state_write(void *data, const char __user *buf,
-				 size_t count, loff_t *ppos)
+static ssize_t queue_state_write(void *data, struct kiocb *iocb,
+				 struct iov_iter *from)
 {
+	size_t count = iov_iter_count(from);
 	struct request_queue *q = data;
 	char opbuf[16] = { }, *op;
 
@@ -137,7 +138,7 @@ static ssize_t queue_state_write(void *data, const char __user *buf,
 		goto inval;
 	}
 
-	if (copy_from_user(opbuf, buf, count))
+	if (!copy_from_iter_full(opbuf, count, from))
 		return -EFAULT;
 	op = strstrip(opbuf);
 	if (strcmp(op, "run") == 0) {
@@ -540,12 +541,11 @@ static int blk_mq_debugfs_show(struct seq_file *m, void *v)
 	return attr->show(data, m);
 }
 
-static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf,
-				    size_t count, loff_t *ppos)
+static ssize_t blk_mq_debugfs_write(struct kiocb *iocb, struct iov_iter *from)
 {
-	struct seq_file *m = file->private_data;
+	struct seq_file *m = iocb->ki_filp->private_data;
 	const struct blk_mq_debugfs_attr *attr = m->private;
-	void *data = d_inode(file->f_path.dentry->d_parent)->i_private;
+	void *data = d_inode(iocb->ki_filp->f_path.dentry->d_parent)->i_private;
 
 	/*
 	 * Attributes that only implement .seq_ops are read-only and 'attr' is
@@ -554,7 +554,7 @@ static ssize_t blk_mq_debugfs_write(struct file *file, const char __user *buf,
 	if (attr == data || !attr->write)
 		return -EPERM;
 
-	return attr->write(data, buf, count, ppos);
+	return attr->write(data, iocb, from);
 }
 
 static int blk_mq_debugfs_open(struct inode *inode, struct file *file)
@@ -591,8 +591,8 @@ static int blk_mq_debugfs_release(struct inode *inode, struct file *file)
 
 static const struct file_operations blk_mq_debugfs_fops = {
 	.open		= blk_mq_debugfs_open,
-	.read		= seq_read,
-	.write		= blk_mq_debugfs_write,
+	.read_iter	= seq_read_iter,
+	.write_iter	= blk_mq_debugfs_write,
 	.llseek		= seq_lseek,
 	.release	= blk_mq_debugfs_release,
 };
diff --git a/block/blk-mq-debugfs.h b/block/blk-mq-debugfs.h
index 9c7d4b6117d4..22c65e5ff430 100644
--- a/block/blk-mq-debugfs.h
+++ b/block/blk-mq-debugfs.h
@@ -12,7 +12,7 @@ struct blk_mq_debugfs_attr {
 	const char *name;
 	umode_t mode;
 	int (*show)(void *, struct seq_file *);
-	ssize_t (*write)(void *, const char __user *, size_t, loff_t *);
+	ssize_t (*write)(void *, struct kiocb *, struct iov_iter *);
 	/* Set either .show or .seq_ops. */
 	const struct seq_operations *seq_ops;
 };
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ