lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-427-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:19:26 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 426/437] firmware: xilinx: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/firmware/xilinx/zynqmp-debug.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp-debug.c b/drivers/firmware/xilinx/zynqmp-debug.c
index 8528850af889..8d64bffd1890 100644
--- a/drivers/firmware/xilinx/zynqmp-debug.c
+++ b/drivers/firmware/xilinx/zynqmp-debug.c
@@ -143,9 +143,8 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
  * Return: Number of bytes copied if PM-API request succeeds,
  *	   the corresponding error code otherwise
  */
-static ssize_t zynqmp_pm_debugfs_api_write(struct file *file,
-					   const char __user *ptr, size_t len,
-					   loff_t *off)
+static ssize_t zynqmp_pm_debugfs_api_write(struct kiocb *iocb,
+					   struct iov_iter *from)
 {
 	char *kern_buff, *tmp_buff;
 	char *pm_api_req;
@@ -153,16 +152,17 @@ static ssize_t zynqmp_pm_debugfs_api_write(struct file *file,
 	u64 pm_api_arg[4] = {0, 0, 0, 0};
 	/* Return values from PM APIs calls */
 	u32 pm_api_ret[4] = {0, 0, 0, 0};
+	size_t len = iov_iter_count(from);
 
 	int ret;
 	int i = 0;
 
 	strcpy(debugfs_buf, "");
 
-	if (*off != 0 || len <= 1 || len > PAGE_SIZE - 1)
+	if (iocb->ki_pos != 0 || len <= 1 || len > PAGE_SIZE - 1)
 		return -EINVAL;
 
-	kern_buff = memdup_user_nul(ptr, len);
+	kern_buff = iterdup_user(from, len);
 	if (IS_ERR(kern_buff))
 		return PTR_ERR(kern_buff);
 	tmp_buff = kern_buff;
@@ -201,18 +201,18 @@ static ssize_t zynqmp_pm_debugfs_api_write(struct file *file,
  * Return: Length of the version string on success
  *	   else error code
  */
-static ssize_t zynqmp_pm_debugfs_api_read(struct file *file, char __user *ptr,
-					  size_t len, loff_t *off)
+static ssize_t zynqmp_pm_debugfs_api_read(struct kiocb *iocb,
+					  struct iov_iter *to)
 {
-	return simple_read_from_buffer(ptr, len, off, debugfs_buf,
-				       strlen(debugfs_buf));
+	return simple_copy_to_iter(debugfs_buf, &iocb->ki_pos,
+				       strlen(debugfs_buf), to);
 }
 
 /* Setup debugfs fops */
 static const struct file_operations fops_zynqmp_pm_dbgfs = {
 	.owner = THIS_MODULE,
-	.write = zynqmp_pm_debugfs_api_write,
-	.read = zynqmp_pm_debugfs_api_read,
+	.write_iter = zynqmp_pm_debugfs_api_write,
+	.read_iter = zynqmp_pm_debugfs_api_read,
 };
 
 /**
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ