hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/fs/eventfd.c
....@@ -266,17 +266,17 @@
266266 return sizeof(ucnt);
267267 }
268268
269
-static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t count,
270
- loff_t *ppos)
269
+static ssize_t eventfd_write(struct kiocb *iocb, struct iov_iter *from)
271270 {
271
+ struct file *file = iocb->ki_filp;
272272 struct eventfd_ctx *ctx = file->private_data;
273273 ssize_t res;
274274 __u64 ucnt;
275275 DECLARE_WAITQUEUE(wait, current);
276276
277
- if (count < sizeof(ucnt))
277
+ if (iov_iter_count(from) < sizeof(ucnt))
278278 return -EINVAL;
279
- if (copy_from_user(&ucnt, buf, sizeof(ucnt)))
279
+ if (copy_from_iter(&ucnt, sizeof(ucnt), from) != sizeof(ucnt))
280280 return -EFAULT;
281281 if (ucnt == ULLONG_MAX)
282282 return -EINVAL;
....@@ -333,7 +333,7 @@
333333 .release = eventfd_release,
334334 .poll = eventfd_poll,
335335 .read_iter = eventfd_read,
336
- .write = eventfd_write,
336
+ .write_iter = eventfd_write,
337337 .llseek = noop_llseek,
338338 };
339339