lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:   Sat,  2 Jan 2021 16:04:51 -0500
From:   noah <goldstein.w.n@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     goldstein.w.n@...il.com, Jens Axboe <axboe@...nel.dk>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        io-uring@...r.kernel.org (open list:IO_URING),
        linux-fsdevel@...r.kernel.org (open list:FILESYSTEMS (VFS and
        infrastructure)), linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] fs/io_uring.c: remove unnecessary boolean instructions that add uops

This patch drops unnecessary comparisons to turn return values into
booleans. There is no reason to do a != for cancelled and posted as
they can be set to a boolean directly more efficiently.

Signed-off-by: noah <goldstein.w.n@...il.com>
---
 fs/io_uring.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ca46f314640b..6a46594e749a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1607,11 +1607,11 @@ static bool io_kill_timeouts(struct io_ring_ctx *ctx, struct task_struct *tsk,
 	list_for_each_entry_safe(req, tmp, &ctx->timeout_list, timeout.list) {
 		if (io_match_task(req, tsk, files)) {
 			io_kill_timeout(req);
-			canceled++;
+			canceled = 1;
 		}
 	}
 	spin_unlock_irq(&ctx->completion_lock);
-	return canceled != 0;
+	return canceled;
 }
 
 static void __io_queue_deferred(struct io_ring_ctx *ctx)
@@ -5491,7 +5491,7 @@ static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk,
 		list = &ctx->cancel_hash[i];
 		hlist_for_each_entry_safe(req, tmp, list, hash_node) {
 			if (io_match_task(req, tsk, files))
-				posted += io_poll_remove_one(req);
+				posted |= io_poll_remove_one(req);
 		}
 	}
 	spin_unlock_irq(&ctx->completion_lock);
@@ -5499,7 +5499,7 @@ static bool io_poll_remove_all(struct io_ring_ctx *ctx, struct task_struct *tsk,
 	if (posted)
 		io_cqring_ev_posted(ctx);
 
-	return posted != 0;
+	return posted;
 }
 
 static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr)
-- 
2.29.2

Powered by blists - more mailing lists