linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fork: simplify overcomplicated if conditions
@ 2025-09-04  6:46 Joey Pabalinas
  2025-09-04  9:56 ` Kiryl Shutsemau
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joey Pabalinas @ 2025-09-04  6:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, Kees Cook, Joey Pabalinas

[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]

Since `((a & (b|c)) == (b|c))` is the same thing as `(a & (b|c))`, use
the second version which is simpler.

Signed-off-by: Joey Pabalinas <joeypabalinas@gmail.com>
---
 kernel/fork.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index af673856499dcaa35e..cb49f25e30e69edaa5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1930,14 +1930,14 @@ __latent_entropy struct task_struct *copy_process(
 
 	/*
 	 * Don't allow sharing the root directory with processes in a different
 	 * namespace
 	 */
-	if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
+	if (clone_flags & (CLONE_NEWNS|CLONE_FS))
 		return ERR_PTR(-EINVAL);
 
-	if ((clone_flags & (CLONE_NEWUSER|CLONE_FS)) == (CLONE_NEWUSER|CLONE_FS))
+	if (clone_flags & (CLONE_NEWUSER|CLONE_FS))
 		return ERR_PTR(-EINVAL);
 
 	/*
 	 * Thread groups must share signals as well, and detached threads
 	 * can only be started up within the thread group.
-- 
Cheers,
Joey Pabalinas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-09-08  6:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-04  6:46 [PATCH] fork: simplify overcomplicated if conditions Joey Pabalinas
2025-09-04  9:56 ` Kiryl Shutsemau
2025-09-04 10:04   ` Joey Pabalinas
2025-09-04 11:16     ` David Hildenbrand
2025-09-04 10:41 ` [syzbot ci] " syzbot ci
2025-09-08  6:52 ` [PATCH] " kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox