[PATCH 091/437] lsm: convert to read/write iterators

Jens Axboe
2024-04-11T15:34:18Z

security/safesetid/securityfs.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/security/safesetid/securityfs.c b/security/safesetid/securityfs.c
index 25310468bcdd..82e1e9c37db2 100644
--- a/security/safesetid/securityfs.c
+++ b/security/safesetid/securityfs.c
@@ -245,6 +245,7 @@ static ssize_t safesetid_uid_file_write(struct file *file,

return handle_policy_update(file, buf, len, UID);
}
+FOPS_WRITE_ITER_HELPER(safesetid_uid_file_write);

static ssize_t safesetid_gid_file_write(struct file *file,
const char __user *buf,
@@ -259,6 +260,7 @@ static ssize_t safesetid_gid_file_write(struct file *file,

return handle_policy_update(file, buf, len, GID);
}
+FOPS_WRITE_ITER_HELPER(safesetid_gid_file_write);

static ssize_t safesetid_file_read(struct file *file, char __user *buf,
size_t len, loff_t *ppos, struct mutex *policy_update_lock, struct __rcu setid_ruleset* ruleset)
@@ -285,6 +287,7 @@ static ssize_t safesetid_uid_file_read(struct file *file, char __user *buf,
return safesetid_file_read(file, buf, len, ppos,
&uid_policy_update_lock, safesetid_setuid_rules);
}
+FOPS_READ_ITER_HELPER(safesetid_uid_file_read);

static ssize_t safesetid_gid_file_read(struct file *file, char __user *buf,
size_t len, loff_t *ppos)
@@ -292,17 +295,16 @@ static ssize_t safesetid_gid_file_read(struct file *file, char __user *buf,
return safesetid_file_read(file, buf, len, ppos,
&gid_policy_update_lock, safesetid_setgid_rules);
}
-
-
+FOPS_READ_ITER_HELPER(safesetid_gid_file_read);

static const struct file_operations safesetid_uid_file_fops = {
- .read = safesetid_uid_file_read,
- .write = safesetid_uid_file_write,
+ .read_iter = safesetid_uid_file_read_iter,
+ .write_iter = safesetid_uid_file_write_iter,
};

static const struct file_operations safesetid_gid_file_fops = {
- .read = safesetid_gid_file_read,
- .write = safesetid_gid_file_write,
+ .read_iter = safesetid_gid_file_read_iter,
+ .write_iter = safesetid_gid_file_write_iter,
};

static int __init safesetid_init_securityfs(void)
--
2.43.0