[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <357638f71edc7f1d9814b1851a64e09a8895bffc.1756968204.git.joeypabalinas@gmail.com>
Date: Wed, 3 Sep 2025 20:46:29 -1000
From: Joey Pabalinas <joeypabalinas@...il.com>
To: linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, Kees Cook <kees@...nel.org>,
Joey Pabalinas <joeypabalinas@...il.com>
Subject: [PATCH] fork: simplify overcomplicated if conditions
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@...il.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
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists