[PATCH 073/437] kcsan: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 11:55:28 EST


Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
kernel/kcsan/debugfs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/kcsan/debugfs.c b/kernel/kcsan/debugfs.c
index 1d1d1b0e4248..71f444ddc27e 100644
--- a/kernel/kcsan/debugfs.c
+++ b/kernel/kcsan/debugfs.c
@@ -220,14 +220,14 @@ static int debugfs_open(struct inode *inode, struct file *file)
return single_open(file, show_info, NULL);
}

-static ssize_t
-debugfs_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
+static ssize_t debugfs_write(struct kiocb *iocb, struct iov_iter *from)
{
char kbuf[KSYM_NAME_LEN];
char *arg;
+ size_t count = iov_iter_count(from);
int read_len = count < (sizeof(kbuf) - 1) ? count : (sizeof(kbuf) - 1);

- if (copy_from_user(kbuf, buf, read_len))
+ if (!copy_from_iter_full(kbuf, read_len, from))
return -EFAULT;
kbuf[read_len] = '\0';
arg = strstrip(kbuf);
@@ -260,9 +260,9 @@ debugfs_write(struct file *file, const char __user *buf, size_t count, loff_t *o

static const struct file_operations debugfs_ops =
{
- .read = seq_read,
+ .read_iter = seq_read_iter,
.open = debugfs_open,
- .write = debugfs_write,
+ .write_iter = debugfs_write,
.release = single_release
};

--
2.43.0