public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: Change res2 parameter type in io_uring_cmd_done
@ 2024-12-02 14:22 ` Bernd Schubert
  2024-12-03  8:45   ` Kanchan Joshi
  2024-12-03  9:27   ` lizetao
  0 siblings, 2 replies; 3+ messages in thread
From: Bernd Schubert @ 2024-12-02 14:22 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov, Kanchan Joshi
  Cc: io-uring, Bernd Schubert, stable

Change the type of the res2 parameter in io_uring_cmd_done from ssize_t
to u64. This aligns the parameter type with io_req_set_cqe32_extra,
which expects u64 arguments.
The change eliminates potential issues on 32-bit architectures where
ssize_t might be 32-bit.

Only user of passing res2 is drivers/nvme/host/ioctl.c and it actually
passes u64.

Fixes: ee692a21e9bf ("fs,io_uring: add infrastructure for uring-cmd")
Signed-off-by: Bernd Schubert <[email protected]>
Cc: [email protected]
---
 include/linux/io_uring/cmd.h | 2 +-
 io_uring/uring_cmd.c         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h
index 578a3fdf5c719cf45fd4b6f9c894204d6b4f946c..75691ca2043acdf687709bb2f27829a1bc7a1103 100644
--- a/include/linux/io_uring/cmd.h
+++ b/include/linux/io_uring/cmd.h
@@ -43,7 +43,7 @@ int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
  * Note: the caller should never hard code @issue_flags and is only allowed
  * to pass the mask provided by the core io_uring code.
  */
-void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t res2,
+void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, u64 res2,
 			unsigned issue_flags);
 
 void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c
index d9fb2143f56ff5d13483687fa949c293f9b8dbef..af842e9b4eb975ba56aaeaaa0c2e207a7732beba 100644
--- a/io_uring/uring_cmd.c
+++ b/io_uring/uring_cmd.c
@@ -151,7 +151,7 @@ static inline void io_req_set_cqe32_extra(struct io_kiocb *req,
  * Called by consumers of io_uring_cmd, if they originally returned
  * -EIOCBQUEUED upon receiving the command.
  */
-void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, ssize_t res2,
+void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, u64 res2,
 		       unsigned issue_flags)
 {
 	struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);

---
base-commit: 7af08b57bcb9ebf78675c50069c54125c0a8b795
change-id: 20241202-io_uring_cmd_done-res2-as-u64-217a4e47b93f

Best regards,
-- 
Bernd Schubert <[email protected]>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] io_uring: Change res2 parameter type in io_uring_cmd_done
  2024-12-02 14:22 ` [PATCH] io_uring: Change res2 parameter type in io_uring_cmd_done Bernd Schubert
@ 2024-12-03  8:45   ` Kanchan Joshi
  2024-12-03  9:27   ` lizetao
  1 sibling, 0 replies; 3+ messages in thread
From: Kanchan Joshi @ 2024-12-03  8:45 UTC (permalink / raw)
  To: Bernd Schubert, Jens Axboe, Pavel Begunkov; +Cc: io-uring, stable

Reviewed-by: Kanchan Joshi <[email protected]>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] io_uring: Change res2 parameter type in io_uring_cmd_done
  2024-12-02 14:22 ` [PATCH] io_uring: Change res2 parameter type in io_uring_cmd_done Bernd Schubert
  2024-12-03  8:45   ` Kanchan Joshi
@ 2024-12-03  9:27   ` lizetao
  1 sibling, 0 replies; 3+ messages in thread
From: lizetao @ 2024-12-03  9:27 UTC (permalink / raw)
  To: Bernd Schubert
  Cc: Jens Axboe, Pavel Begunkov, Kanchan Joshi,
	[email protected], [email protected]

Hi,

> -----Original Message-----
> From: Bernd Schubert <[email protected]>
> Sent: Monday, December 2, 2024 10:22 PM
> To: Jens Axboe <[email protected]>; Pavel Begunkov
> <[email protected]>; Kanchan Joshi <[email protected]>
> Cc: [email protected]; Bernd Schubert <[email protected]>;
> [email protected]
> Subject: [PATCH] io_uring: Change res2 parameter type in
> io_uring_cmd_done
> 
> Change the type of the res2 parameter in io_uring_cmd_done from ssize_t to
> u64. This aligns the parameter type with io_req_set_cqe32_extra, which
> expects u64 arguments.
> The change eliminates potential issues on 32-bit architectures where ssize_t
> might be 32-bit.
> 
> Only user of passing res2 is drivers/nvme/host/ioctl.c and it actually passes
> u64.
> 
> Fixes: ee692a21e9bf ("fs,io_uring: add infrastructure for uring-cmd")
> Signed-off-by: Bernd Schubert <[email protected]>
> Cc: [email protected]
> ---
>  include/linux/io_uring/cmd.h | 2 +-
>  io_uring/uring_cmd.c         | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h
> index
> 578a3fdf5c719cf45fd4b6f9c894204d6b4f946c..75691ca2043acdf687709bb2f2
> 7829a1bc7a1103 100644
> --- a/include/linux/io_uring/cmd.h
> +++ b/include/linux/io_uring/cmd.h
> @@ -43,7 +43,7 @@ int io_uring_cmd_import_fixed(u64 ubuf, unsigned
> long len, int rw,
>   * Note: the caller should never hard code @issue_flags and is only allowed
>   * to pass the mask provided by the core io_uring code.
>   */
> -void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t res2,
> +void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, u64 res2,
>  			unsigned issue_flags);
> 
>  void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, diff --git
> a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index
> d9fb2143f56ff5d13483687fa949c293f9b8dbef..af842e9b4eb975ba56aaeaaa0
> c2e207a7732beba 100644
> --- a/io_uring/uring_cmd.c
> +++ b/io_uring/uring_cmd.c
> @@ -151,7 +151,7 @@ static inline void io_req_set_cqe32_extra(struct
> io_kiocb *req,
>   * Called by consumers of io_uring_cmd, if they originally returned
>   * -EIOCBQUEUED upon receiving the command.
>   */
> -void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, ssize_t
> res2,
> +void io_uring_cmd_done(struct io_uring_cmd *ioucmd, ssize_t ret, u64
> +res2,
>  		       unsigned issue_flags)
>  {
>  	struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);
> 
> ---
> base-commit: 7af08b57bcb9ebf78675c50069c54125c0a8b795
> change-id: 20241202-io_uring_cmd_done-res2-as-u64-217a4e47b93f
> 
> Best regards,
> --
> Bernd Schubert <[email protected]>
> 

I have applied this patch to the linux-block/for-next branch and tested compilation
using the CONFIG_IO_URING=y and CONFIG_IO_URING=n options respectively.
A small suggestion is that when CONFIG_IO_URING=n, the ret2 parameter type of io_uring_cmd_done can
also be changed to u64.

Tested-by: Li Zetao <[email protected]>
Reviewed-by: Li Zetao <[email protected]>

--
Li Zetao

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-03  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20241202142239epcas5p14f5b07a60622673a93d6e3e6d91b35d6@epcas5p1.samsung.com>
2024-12-02 14:22 ` [PATCH] io_uring: Change res2 parameter type in io_uring_cmd_done Bernd Schubert
2024-12-03  8:45   ` Kanchan Joshi
2024-12-03  9:27   ` lizetao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox