* [PATCH liburing 0/2] liburing: fix shortening api issues @ 2022-10-19 14:50 Dylan Yudaken 2022-10-19 14:50 ` [PATCH liburing 1/2] fix int shortening bug in io_uring_recvmsg_validate Dylan Yudaken ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: Dylan Yudaken @ 2022-10-19 14:50 UTC (permalink / raw) To: Jens Axboe, Pavel Begunkov; +Cc: io-uring, kernel-team, Dylan Yudaken The liburing public API has a couple of int shortening issues found by compiling with cc="clang -Wshorten-64-to-32 -Werror" There are a few more in the main library, and a *lot* in the tests, which would be nice to fix up at some point. The public API changes are particularly useful for build systems that include these files and run with these errors enabled. Dylan Yudaken (2): fix int shortening bug in io_uring_recvmsg_validate fix len type of fgettxattr etc src/include/liburing.h | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) base-commit: 13f3fe3af811d8508676dbd1ef552f2b459e1b21 -- 2.30.2 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH liburing 1/2] fix int shortening bug in io_uring_recvmsg_validate 2022-10-19 14:50 [PATCH liburing 0/2] liburing: fix shortening api issues Dylan Yudaken @ 2022-10-19 14:50 ` Dylan Yudaken 2022-10-19 14:50 ` [PATCH liburing 2/2] fix len type of fgettxattr etc Dylan Yudaken ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: Dylan Yudaken @ 2022-10-19 14:50 UTC (permalink / raw) To: Jens Axboe, Pavel Begunkov; +Cc: io-uring, kernel-team, Dylan Yudaken Fix for compilers running with -Wshorten-64-to-32 Fixes: 874406f7fb09 ("add multishot recvmsg API") Signed-off-by: Dylan Yudaken <[email protected]> --- src/include/liburing.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/include/liburing.h b/src/include/liburing.h index 1d049230ddfb..118bba9eea15 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -791,10 +791,9 @@ static inline void io_uring_prep_recv_multishot(struct io_uring_sqe *sqe, static inline struct io_uring_recvmsg_out * io_uring_recvmsg_validate(void *buf, int buf_len, struct msghdr *msgh) { - int header = msgh->msg_controllen + msgh->msg_namelen + + unsigned long header = msgh->msg_controllen + msgh->msg_namelen + sizeof(struct io_uring_recvmsg_out); - - if (buf_len < header) + if (buf_len < 0 || (unsigned long)buf_len < header) return NULL; return (struct io_uring_recvmsg_out *)buf; } -- 2.30.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH liburing 2/2] fix len type of fgettxattr etc 2022-10-19 14:50 [PATCH liburing 0/2] liburing: fix shortening api issues Dylan Yudaken 2022-10-19 14:50 ` [PATCH liburing 1/2] fix int shortening bug in io_uring_recvmsg_validate Dylan Yudaken @ 2022-10-19 14:50 ` Dylan Yudaken 2022-10-19 19:49 ` [PATCH liburing 0/2] liburing: fix shortening api issues Jens Axboe 2022-10-19 20:52 ` Ammar Faizi 3 siblings, 0 replies; 5+ messages in thread From: Dylan Yudaken @ 2022-10-19 14:50 UTC (permalink / raw) To: Jens Axboe, Pavel Begunkov; +Cc: io-uring, kernel-team, Dylan Yudaken The size_t len was passed to an unsigned int directly. Take an unsigned int instead which is what is expected by io_uring_prep_rw Fixes: 73849e908ce0 ("liburing: Add helper functions for fgetxattr and getxattr") Fixes: 72f55e271377 ("liburing: add helper functions for setxattr and fsetxattr") Signed-off-by: Dylan Yudaken <[email protected]> --- src/include/liburing.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/include/liburing.h b/src/include/liburing.h index 118bba9eea15..780a19ccb1d9 100644 --- a/src/include/liburing.h +++ b/src/include/liburing.h @@ -991,7 +991,7 @@ static inline void io_uring_prep_getxattr(struct io_uring_sqe *sqe, const char *name, char *value, const char *path, - size_t len) + unsigned int len) { io_uring_prep_rw(IORING_OP_GETXATTR, sqe, 0, name, len, (__u64) (uintptr_t) value); @@ -1004,7 +1004,7 @@ static inline void io_uring_prep_setxattr(struct io_uring_sqe *sqe, const char *value, const char *path, int flags, - size_t len) + unsigned int len) { io_uring_prep_rw(IORING_OP_SETXATTR, sqe, 0, name, len, (__u64) (uintptr_t) value); @@ -1013,10 +1013,10 @@ static inline void io_uring_prep_setxattr(struct io_uring_sqe *sqe, } static inline void io_uring_prep_fgetxattr(struct io_uring_sqe *sqe, - int fd, + int fd, const char *name, char *value, - size_t len) + unsigned int len) { io_uring_prep_rw(IORING_OP_FGETXATTR, sqe, fd, name, len, (__u64) (uintptr_t) value); @@ -1024,11 +1024,11 @@ static inline void io_uring_prep_fgetxattr(struct io_uring_sqe *sqe, } static inline void io_uring_prep_fsetxattr(struct io_uring_sqe *sqe, - int fd, - const char *name, - const char *value, - int flags, - size_t len) + int fd, + const char *name, + const char *value, + int flags, + unsigned int len) { io_uring_prep_rw(IORING_OP_FSETXATTR, sqe, fd, name, len, (__u64) (uintptr_t) value); -- 2.30.2 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH liburing 0/2] liburing: fix shortening api issues 2022-10-19 14:50 [PATCH liburing 0/2] liburing: fix shortening api issues Dylan Yudaken 2022-10-19 14:50 ` [PATCH liburing 1/2] fix int shortening bug in io_uring_recvmsg_validate Dylan Yudaken 2022-10-19 14:50 ` [PATCH liburing 2/2] fix len type of fgettxattr etc Dylan Yudaken @ 2022-10-19 19:49 ` Jens Axboe 2022-10-19 20:52 ` Ammar Faizi 3 siblings, 0 replies; 5+ messages in thread From: Jens Axboe @ 2022-10-19 19:49 UTC (permalink / raw) To: Pavel Begunkov, Dylan Yudaken; +Cc: kernel-team, io-uring On Wed, 19 Oct 2022 07:50:40 -0700, Dylan Yudaken wrote: > The liburing public API has a couple of int shortening issues found by > compiling with cc="clang -Wshorten-64-to-32 -Werror" > > There are a few more in the main library, and a *lot* in the tests, which > would be nice to fix up at some point. The public API changes are > particularly useful for build systems that include these files and run > with these errors enabled. > > [...] Applied, thanks! [1/2] fix int shortening bug in io_uring_recvmsg_validate commit: d916aa80993438dbcec700202b21b550edc03941 [2/2] fix len type of fgettxattr etc commit: 5698e179a1308aa8019a482ca910a832b5737e5f Best regards, -- Jens Axboe ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH liburing 0/2] liburing: fix shortening api issues 2022-10-19 14:50 [PATCH liburing 0/2] liburing: fix shortening api issues Dylan Yudaken ` (2 preceding siblings ...) 2022-10-19 19:49 ` [PATCH liburing 0/2] liburing: fix shortening api issues Jens Axboe @ 2022-10-19 20:52 ` Ammar Faizi 3 siblings, 0 replies; 5+ messages in thread From: Ammar Faizi @ 2022-10-19 20:52 UTC (permalink / raw) To: Dylan Yudaken Cc: Jens Axboe, Pavel Begunkov, io-uring Mailing List, Facebook Kernel Team On 10/19/22 9:50 PM, Dylan Yudaken wrote: > The liburing public API has a couple of int shortening issues found by > compiling with cc="clang -Wshorten-64-to-32 -Werror" > > There are a few more in the main library, and a *lot* in the tests, which > would be nice to fix up at some point. The public API changes are > particularly useful for build systems that include these files and run > with these errors enabled. Let's clean the main library up, but ignore the tests for now. I'll send a cleanup series for review before the release. -- Ammar Faizi ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-10-19 20:52 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-10-19 14:50 [PATCH liburing 0/2] liburing: fix shortening api issues Dylan Yudaken 2022-10-19 14:50 ` [PATCH liburing 1/2] fix int shortening bug in io_uring_recvmsg_validate Dylan Yudaken 2022-10-19 14:50 ` [PATCH liburing 2/2] fix len type of fgettxattr etc Dylan Yudaken 2022-10-19 19:49 ` [PATCH liburing 0/2] liburing: fix shortening api issues Jens Axboe 2022-10-19 20:52 ` Ammar Faizi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox