From: Kees Cook <keescook@chromium.org>
To: Igor Stoppa <igor.stoppa@gmail.com>
Cc: Igor Stoppa <igor.stoppa@huawei.com>,
linux-security-module <linux-security-module@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] seccomp: remove unnecessary unlikely()
Date: Wed, 5 Sep 2018 15:23:08 -0700 [thread overview]
Message-ID: <CAGXu5j+e2n6pUW+40ZNm5qifd8dVEEryN-Qfqe7ok-KZHP1Hyw@mail.gmail.com> (raw)
In-Reply-To: <20180905203443.32289-1-igor.stoppa@huawei.com>
On Wed, Sep 5, 2018 at 1:34 PM, Igor Stoppa <igor.stoppa@gmail.com> wrote:
> WARN_ON() already contains an unlikely(), so it's not necessary to wrap it
> into another.
>
> Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
> Acked-by: Kees Cook <keescook@chromium.org>
Should I take this, or is it part of your series going somewhere else?
-Kees
> Cc: linux-security-module@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> kernel/seccomp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index fd023ac24e10..5a2a9af4663e 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -195,7 +195,7 @@ static u32 seccomp_run_filters(const struct seccomp_data *sd,
> READ_ONCE(current->seccomp.filter);
>
> /* Ensure unexpected behavior doesn't result in failing open. */
> - if (unlikely(WARN_ON(f == NULL)))
> + if (WARN_ON(f == NULL))
> return SECCOMP_RET_KILL_PROCESS;
>
> if (!sd) {
> @@ -297,7 +297,7 @@ static inline pid_t seccomp_can_sync_threads(void)
> /* Return the first thread that cannot be synchronized. */
> failed = task_pid_vnr(thread);
> /* If the pid cannot be resolved, then return -ESRCH */
> - if (unlikely(WARN_ON(failed == 0)))
> + if (WARN_ON(failed == 0))
> failed = -ESRCH;
> return failed;
> }
> --
> 2.17.1
>
--
Kees Cook
Pixel Security
next prev parent reply other threads:[~2018-09-05 22:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-05 20:34 [PATCH] seccomp: remove unnecessary unlikely() Igor Stoppa
2018-09-05 22:23 ` Kees Cook [this message]
2018-09-05 22:49 ` Igor Stoppa
2018-09-05 23:31 ` Kees Cook
2018-09-06 0:08 ` James Morris
2018-09-06 0:13 ` Kees Cook
2018-09-06 20:31 ` James Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAGXu5j+e2n6pUW+40ZNm5qifd8dVEEryN-Qfqe7ok-KZHP1Hyw@mail.gmail.com \
--to=keescook@chromium.org \
--cc=igor.stoppa@gmail.com \
--cc=igor.stoppa@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).