public inbox for [email protected]
 help / color / mirror / Atom feed
From: Dylan Yudaken <[email protected]>
To: Jens Axboe <[email protected]>, Pavel Begunkov <[email protected]>
Cc: <[email protected]>, <[email protected]>,
	Dylan Yudaken <[email protected]>
Subject: [PATCH liburing 1/2] fix int shortening bug in io_uring_recvmsg_validate
Date: Wed, 19 Oct 2022 07:50:41 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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


  reply	other threads:[~2022-10-19 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 14:50 [PATCH liburing 0/2] liburing: fix shortening api issues Dylan Yudaken
2022-10-19 14:50 ` Dylan Yudaken [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox