diff mbox series

io_uring/uring_cmd: specify io_uring_cmd_import_fixed() pointer type

Message ID 20250228221514.604350-1-csander@purestorage.com (mailing list archive)
State New
Headers show
Series io_uring/uring_cmd: specify io_uring_cmd_import_fixed() pointer type | expand

Commit Message

Caleb Sander Mateos Feb. 28, 2025, 10:15 p.m. UTC
io_uring_cmd_import_fixed() takes a struct io_uring_cmd *, but the type
of the ioucmd parameter is void *. Make the pointer type explicit so the
compiler can type check it.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
---
 include/linux/io_uring/cmd.h | 10 ++++++----
 io_uring/uring_cmd.c         |  3 ++-
 2 files changed, 8 insertions(+), 5 deletions(-)

Comments

Jens Axboe March 1, 2025, 2:23 a.m. UTC | #1
On Fri, 28 Feb 2025 15:15:13 -0700, Caleb Sander Mateos wrote:
> io_uring_cmd_import_fixed() takes a struct io_uring_cmd *, but the type
> of the ioucmd parameter is void *. Make the pointer type explicit so the
> compiler can type check it.
> 
> 

Applied, thanks!

[1/1] io_uring/uring_cmd: specify io_uring_cmd_import_fixed() pointer type
      commit: 0c542a69cbcd1fefad32c59cea7a80413fe60922

Best regards,
diff mbox series

Patch

diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h
index cf8d80d84734..5bc4f0d58506 100644
--- a/include/linux/io_uring/cmd.h
+++ b/include/linux/io_uring/cmd.h
@@ -38,11 +38,12 @@  static inline void io_uring_cmd_private_sz_check(size_t cmd_sz)
 	((pdu_type *)&(cmd)->pdu) \
 )
 
 #if defined(CONFIG_IO_URING)
 int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
-			      struct iov_iter *iter, void *ioucmd,
+			      struct iov_iter *iter,
+			      struct io_uring_cmd *ioucmd,
 			      unsigned int issue_flags);
 
 /*
  * Completes the request, i.e. posts an io_uring CQE and deallocates @ioucmd
  * and the corresponding io_uring request.
@@ -66,13 +67,14 @@  void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
 
 /* Execute the request from a blocking context */
 void io_uring_cmd_issue_blocking(struct io_uring_cmd *ioucmd);
 
 #else
-static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
-			      struct iov_iter *iter, void *ioucmd,
-			      unsigned int issue_flags)
+static inline int
+io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
+			  struct iov_iter *iter, struct io_uring_cmd *ioucmd,
+			  unsigned int issue_flags)
 {
 	return -EOPNOTSUPP;
 }
 static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
 		u64 ret2, unsigned issue_flags)
diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index 31d5e0948af1..de39b602aa82 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -243,11 +243,12 @@  int io_uring_cmd(struct io_kiocb *req, unsigned int issue_flags)
 	io_req_set_res(req, ret, 0);
 	return IOU_OK;
 }
 
 int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
-			      struct iov_iter *iter, void *ioucmd,
+			      struct iov_iter *iter,
+			      struct io_uring_cmd *ioucmd,
 			      unsigned int issue_flags)
 {
 	struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
 
 	return io_import_reg_buf(req, iter, ubuf, len, rw, issue_flags);