Skip to contentSkip to conversation

io_uring/net: Remove useless min_not_zero() usage

PATCH Applied Clément Léger 3 participants 3 messages Oct 23 – Oct 26 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring/net: Remove useless min_not_zero() usage

In the else arm, sel->val is necessarily 0 so the min_not_zero() actually always returns kmsg->msg.msg_inq. Remove the min_not_zero() usage and replace it with kmsg->msg.msg_inq.

---
 io_uring/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/net.c +1 -1
index f5f4f3ce6ef3..efc8ea5010ad 100644
@@ -1146,7 +1146,7 @@ static int io_recv_buf_select(struct io_kiocb *req, struct io_async_msghdr *kmsg
 		if (sel->val)
 			arg.max_len = sel->val;
 		else if (kmsg->msg.msg_inq > 1)
-			arg.max_len = min_not_zero(sel->val, (ssize_t) kmsg->msg.msg_inq);
+			arg.max_len = kmsg->msg.msg_inq;
 
 		/* if mshot limited, ensure we don't go over */
 		if (sr->flags & IORING_RECV_MSHOT_LIM)

--
2.53.0-Meta

Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Clément Léger

In the else arm, sel->val is necessarily 0 so the min_not_zero() actually always returns kmsg->msg.msg_inq. Remove the min_not_zero() usage and replace it with kmsg->msg.msg_inq.

Quoted 19 lines
---
 io_uring/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/net.c +1 -2
index f5f4f3ce6ef3..efc8ea5010ad 100644
@@ -1146,7 +1146,7 @@ static int io_recv_buf_select(struct io_kiocb *req, struct io_async_msghdr *kmsg
 		if (sel->val)
 			arg.max_len = sel->val;
 		else if (kmsg->msg.msg_inq > 1)
-			arg.max_len = min_not_zero(sel->val, (ssize_t) kmsg->msg.msg_inq);
+			arg.max_len = kmsg->msg.msg_inq;
 
 		/* if mshot limited, ensure we don't go over */
 		if (sr->flags & IORING_RECV_MSHOT_LIM)
--

2.53.0-Meta

Signature · 1 line
Gabriel Krisman Bertazi
maintainer Applied
#2 lore raw
In reply to Clément Léger
Quoted 3 lines · Clément Léger

In the else arm, sel->val is necessarily 0 so the min_not_zero() actually always returns kmsg->msg.msg_inq. Remove the min_not_zero() usage and replace it with kmsg->msg.msg_inq.

Applied, thanks!

[1/1] io_uring/net: Remove useless min_not_zero() usage

      commit: 70884ea2d636611e547f3da85fbfb8aadfa2ab4d

Best regards,

Signature · 1 line
Jens Axboe