[PATCH 266/437] watchdog: gef_wdt: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 12:41:00 EST


Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
drivers/watchdog/gef_wdt.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index 6a1db1c783fa..c946fd169966 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -132,9 +132,10 @@ static void gef_wdt_set_timeout(unsigned int timeout)
}


-static ssize_t gef_wdt_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t gef_wdt_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t len = iov_iter_count(from);
+
if (len) {
if (!nowayout) {
size_t i;
@@ -143,7 +144,7 @@ static ssize_t gef_wdt_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;
@@ -246,7 +247,7 @@ static int gef_wdt_release(struct inode *inode, struct file *file)
static const struct file_operations gef_wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = gef_wdt_write,
+ .write_iter = gef_wdt_write,
.unlocked_ioctl = gef_wdt_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = gef_wdt_open,
--
2.43.0