[PATCH 074/437] module: convert to read/write iterators

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


Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
kernel/module/stats.c | 8 ++++----
kernel/module/tracking.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/module/stats.c b/kernel/module/stats.c
index 3ba0e98b3c91..42bb95beb834 100644
--- a/kernel/module/stats.c
+++ b/kernel/module/stats.c
@@ -270,8 +270,7 @@ int try_add_failed_module(const char *name, enum fail_dup_mod_reason reason)
#define MAX_PREAMBLE 1024
#define MAX_FAILED_MOD_PRINT 112
#define MAX_BYTES_PER_MOD 64
-static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf,
- size_t count, loff_t *ppos)
+static ssize_t read_file_mod_stats(struct kiocb *iocb, struct iov_iter *to)
{
struct mod_fail_load *mod_fail;
unsigned int len, size, count_failed = 0;
@@ -391,16 +390,17 @@ static ssize_t read_file_mod_stats(struct file *file, char __user *user_buf,
out_unlock:
mutex_unlock(&module_mutex);
out:
- ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
+ ret = simple_copy_to_iter(buf, &iocb->ki_pos, len, to);
kfree(buf);
return ret;
}
+
#undef MAX_PREAMBLE
#undef MAX_FAILED_MOD_PRINT
#undef MAX_BYTES_PER_MOD

static const struct file_operations fops_mod_stats = {
- .read = read_file_mod_stats,
+ .read_iter = read_file_mod_stats,
.open = simple_open,
.owner = THIS_MODULE,
.llseek = default_llseek,
diff --git a/kernel/module/tracking.c b/kernel/module/tracking.c
index 16742d1c630c..a163944f609d 100644
--- a/kernel/module/tracking.c
+++ b/kernel/module/tracking.c
@@ -114,7 +114,7 @@ static int unloaded_tainted_modules_open(struct inode *inode, struct file *file)

static const struct file_operations unloaded_tainted_modules_fops = {
.open = unloaded_tainted_modules_open,
- .read = seq_read,
+ .read_iter = seq_read_iter,
.llseek = seq_lseek,
.release = seq_release,
};
--
2.43.0