Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp83626imm; Wed, 5 Sep 2018 15:25:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbapH1Wvm9fwHOqyGzwmmmBV22RqWuyUCakwO8Pi8W0uehtr14jifGk1DJIjCiX5eEfoaJJ X-Received: by 2002:a65:594b:: with SMTP id g11-v6mr38561610pgu.260.1536186303605; Wed, 05 Sep 2018 15:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536186303; cv=none; d=google.com; s=arc-20160816; b=IWd1g8HxxJggLMHSe4TxQ1ivxWLehCdbu8cp7ICUWqhQ6webBUSnILHbTeTsFE3qbu j/SBb1QvKN5JZeqy5yPt76D+ebyvYkuQ7mzHnIo/Xozrvj4Xdwtxqx+EMt0g6XuThVHg ZSBALChVMTz12CCixw7bohnX8FPPMghLRjLxiXjMRtJn/znl88UDXrkfTQq80XKOMWRf 25CN3GJDVIKTHhg80rC8mNUHlx6xOmiudaR4TGfsNRs2Xh7Rq4jaFv5adflo0O7LOawV uu7siqvN/SbQ1+PTi7brrWtxVV+HHP4m8B+C3Nef7dCOPVFOgEtIgKH85K3yWHVGy6Ou F/Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=8vnAH5qkzbH07z69lEci9DyJ1rUdDPuAng5c7CscdgA=; b=RA9tlnc+NtS89QWIVQHJ13I64OvvGalSp2keJITToOmVoD4hLQyL0NfylIhEOIjJLi 0YeMGE4vCVJuqR5/QcZjmmo0b2D/SH4cWePGBsMZy+SAKDI+OuHxcZ+GtNqGvgLwLGIs e33CbNkOdB60Ge4PGg+x0ANf6D/u8p7CRD6itbv0gUL87+ga+OxF22r0LbsjMhEw/8tt BpGc0hgbE9I0hYBpOp6ASG4gkHfBY4ONTYyApZbIseLgpx9HQqS12+x6qRGawlU6ZcK1 tO+XZZXZ9SjZeaAgIL7gMq4xJeoRDf3tAQWk/d8Wwm7zi7D0PlmF04kwQbafEMVhYEct L95w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GmjexAbF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13-v6si3187334pgk.344.2018.09.05.15.24.48; Wed, 05 Sep 2018 15:25:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GmjexAbF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727794AbeIFCz1 (ORCPT + 99 others); Wed, 5 Sep 2018 22:55:27 -0400 Received: from mail-yb1-f194.google.com ([209.85.219.194]:36317 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727364AbeIFCz1 (ORCPT ); Wed, 5 Sep 2018 22:55:27 -0400 Received: by mail-yb1-f194.google.com with SMTP id d34-v6so3355346yba.3 for ; Wed, 05 Sep 2018 15:23:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8vnAH5qkzbH07z69lEci9DyJ1rUdDPuAng5c7CscdgA=; b=GmjexAbFnGal589O945hJZGSkvf3rMAySDyPR5le02p0aAYF34QEK544CgTplYwhEV jGsiuuiE8cNk2yJKy4PTolZVDddgBG2ot/MVC5CyumXLzGqmIsLyyRT+kBXro6vuJYyp jYEzSZysW1+wuy6QCpcVU+SgzbndWe3qFBKA4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8vnAH5qkzbH07z69lEci9DyJ1rUdDPuAng5c7CscdgA=; b=IcRXiOzU88Hf5Gx0O04buhKaQf+WTJbDtT5dOH7EtONiIHk3TfXSojwUNrx1o4jO5G AqyuxwFop7zEFknKvdJcX/QlzJajhb/pc4e3uLbbu/3K8kMDCwPE7SQhEqQEa5pslIp/ Us3jJr4yl/n/Ewtp1yyGdTyLGsNHErR+z6f43tXroVlX4tfKjUaN8uvIKEvc7GG55R57 Qafk6ApjtJtyfcFKhXkJ2F7Xjikjns3YLgZLLo8oEGFJ7Vzp1iW/uQk3hIU6vzj3E3iS R+QLuf2odgsRf95w6S6Ncve/0AofenENzuF7CeilZBif13TDUR3lCesdo/0RPR2ls+hc bvHg== X-Gm-Message-State: APzg51A7E+kCdCxYDCXWsomSUlTGMB2IiWb1nMz0mg0dMppLy9BkQSuI 77OB3uFVdcSNWQpZpajXETkWAt7qvUM= X-Received: by 2002:a25:6dd4:: with SMTP id i203-v6mr20094222ybc.438.1536186190562; Wed, 05 Sep 2018 15:23:10 -0700 (PDT) Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com. [209.85.219.172]) by smtp.gmail.com with ESMTPSA id w80-v6sm2480617ywd.55.2018.09.05.15.23.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 15:23:09 -0700 (PDT) Received: by mail-yb1-f172.google.com with SMTP id k5-v6so3338443ybo.10 for ; Wed, 05 Sep 2018 15:23:09 -0700 (PDT) X-Received: by 2002:a25:19c3:: with SMTP id 186-v6mr22528809ybz.410.1536186188732; Wed, 05 Sep 2018 15:23:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:5f04:0:0:0:0:0 with HTTP; Wed, 5 Sep 2018 15:23:08 -0700 (PDT) In-Reply-To: <20180905203443.32289-1-igor.stoppa@huawei.com> References: <20180905203443.32289-1-igor.stoppa@huawei.com> From: Kees Cook Date: Wed, 5 Sep 2018 15:23:08 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] seccomp: remove unnecessary unlikely() To: Igor Stoppa Cc: Igor Stoppa , linux-security-module , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 5, 2018 at 1:34 PM, Igor Stoppa wrote: > WARN_ON() already contains an unlikely(), so it's not necessary to wrap it > into another. > > Signed-off-by: Igor Stoppa > Acked-by: Kees Cook 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