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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 16 Nov 2014 12:09:21 -0800
From:	Joe Perches <joe@...ches.com>
To:	Ionut Alexa <ionut.m.alexa@...il.com>, linux-kernel@...r.kernel.org
Cc:	Al Viro <viro@...IV.linux.org.uk>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: [UNNECESSARY PATCH 14/16] signal: Convert for (;;) to do {} while

So the return value is at end of the function.

No change of compiled x86-64 object.

Signed-off-by: Joe Perches <joe@...ches.com>
---
 kernel/signal.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 9b133eb..739d261 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1345,21 +1345,21 @@ int kill_pid_info(int sig, struct siginfo *info, struct pid *pid)
 	int error = -ESRCH;
 	struct task_struct *p;
 
-	for (;;) {
+	do {
 		rcu_read_lock();
 		p = pid_task(pid, PIDTYPE_PID);
 		if (p)
 			error = group_send_sig_info(sig, info, p);
 		rcu_read_unlock();
-		if (likely(!p || error != -ESRCH))
-			return error;
 
 		/*
-		 * The task was unhashed in between, try again.  If it
-		 * is dead, pid_task() will return NULL, if we race with
-		 * de_thread() it will find the new leader.
+		 * If the task is dead, pid_task() will return NULL
+		 * If we race with de_thread() it will find the new leader.
+		 * The task was unhashed in between, try again.
 		 */
-	}
+	} while (unlikely(p && error == -ESRCH));
+
+	return error;
 }
 
 int kill_proc_info(int sig, struct siginfo *info, pid_t pid)
-- 
2.1.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ