[PATCH 269/437] watchdog: mixcomwd: convert to read/write iterators

Jens Axboe
2024-04-11T15:39:09Z

drivers/watchdog/mixcomwd.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
index d387bad377c4..c980e542c31b 100644
--- a/drivers/watchdog/mixcomwd.c
+++ b/drivers/watchdog/mixcomwd.c
@@ -166,9 +166,10 @@ static int mixcomwd_release(struct inode *inode, struct file *file)
}

-static ssize_t mixcomwd_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t mixcomwd_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t len = iov_iter_count(from);
+
if (len) {
if (!nowayout) {
size_t i;
@@ -178,7 +179,7 @@ static ssize_t mixcomwd_write(struct file *file, const char __user *data,

for (i = 0; i != len; i++) {
char c;
- if (get_user(c, data + i))
+ if (get_iter(c, from))
return -EFAULT;
if (c == 'V')
expect_close = 42;
@@ -225,7 +226,7 @@ static long mixcomwd_ioctl(struct file *file,
static const struct file_operations mixcomwd_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = mixcomwd_write,
+ .write_iter = mixcomwd_write,
.unlocked_ioctl = mixcomwd_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = mixcomwd_open,
--
2.43.0