Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2119943lkv; Thu, 20 May 2021 03:53:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm8FHya+x9UQZchn1Jn8PY/X4Fsu3CgPZyudpmcrsJ8phedS0Ro8xR5qZE7fH1USPSjB8M X-Received: by 2002:a17:906:a00e:: with SMTP id p14mr4187774ejy.66.1621508006209; Thu, 20 May 2021 03:53:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621508006; cv=none; d=google.com; s=arc-20160816; b=LY3h2b+2q9A3DuZYyC+Y4InU592evgIZ5Q5iUHw5iEMix2jxTkk4FTox0c+1RMWUmA 4vEAi+NuMweQxaQR2dmYMo1sBssPaXF82z/IPPP+KbaQYBs70Aw8nx8Skq1WdrboHJDE vIcXK1YBWmJBOcv0whJcbt3ghSxWV+t8pPUunsRzqAj4/qw1t0xnxkl3H5KFO+wiuezR 8UFg3k928jWvudCBqjUeU9xwbqQcelm3TpkkN7pAEISG9w5HPoEZNnA7t7muwj4CziJp ay8CXORXgWbzD2uA0iMsnk0cOVvqCIm6n/4Bge/ye/a0bummJBuL7B9pjmBC9MZLfmCG qf1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LV/DhKMkTX/QiiYwpmQKHHY6Ndg9dWqbYX17UylMicg=; b=kbll+itX3elku5wXdtmrS2btfDXdjn89KjnFAWwch68k9o5ccX02R47jmihMJQvazc b7rA0cObOnjChistReo0xlZylG1bBXrkctD8Dn0+GJEsE9hlaTsguOePiqlI3hPvwWIh rWpX4K30MgrNyokTNtDSASaSMYwiVr6b/yAjCdnXaC9oVm9ud+J7drjBu9W+HFwFEx7k FwXf5mGrjt7CrKsaHykl+37YU0fP+3/BIPrLXUcc0DNYWSYnSHpXmVMvwrJGl7k0puz1 uuWq8jRxUtPWbquvkToO4RXZkC5Y8pp5+1xgHIdznbB1tYIti7VgubNEgX8+0j/hJ9xz Ncow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1A59gddJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r24si2767749ejy.134.2021.05.20.03.52.39; Thu, 20 May 2021 03:53:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1A59gddJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237924AbhETKvl (ORCPT + 99 others); Thu, 20 May 2021 06:51:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:39950 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237878AbhETKf4 (ORCPT ); Thu, 20 May 2021 06:35:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 712A161613; Thu, 20 May 2021 09:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504437; bh=L/Jez19Pc3wQHXKmpNlxL1LxJ5eIjWlSW6+jEMaupH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1A59gddJgjrl36HYUoTg2YY9a5pEANai2on1ORRcGv6aEbjuaTlNaZYWwInBR/DRh hTs1olJ3cLIGI2w0fePmRsHVIzT6UnfouzQAbNN2ztHXQtcb9fOchI+IJZPkpLqJeJ 6Z+/8Lnpqysfz508lgjyhLlGtrcraGL0bZ3DUbrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Scull , Peter Zijlstra , "Steven Rostedt (VMware)" , Will Deacon , Marc Zyngier , Sasha Levin Subject: [PATCH 4.14 201/323] bug: Remove redundant condition check in report_bug Date: Thu, 20 May 2021 11:21:33 +0200 Message-Id: <20210520092127.024263712@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrew Scull [ Upstream commit 3ad1a6cb0abc63d036fc866bd7c2c5983516dec5 ] report_bug() will return early if it cannot find a bug corresponding to the provided address. The subsequent test for the bug will always be true so remove it. Fixes: 1b4cfe3c0a30d ("lib/bug.c: exclude non-BUG/WARN exceptions from report_bug()") Signed-off-by: Andrew Scull Cc: Peter Zijlstra Cc: "Steven Rostedt (VMware)" Reviewed-by: Steven Rostedt (VMware) Acked-by: Will Deacon Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20210318143311.839894-2-ascull@google.com Signed-off-by: Sasha Levin --- lib/bug.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/lib/bug.c b/lib/bug.c index d2c9a099561a..cabecce6ffa7 100644 --- a/lib/bug.c +++ b/lib/bug.c @@ -155,30 +155,27 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs) file = NULL; line = 0; - warning = 0; - if (bug) { #ifdef CONFIG_DEBUG_BUGVERBOSE #ifndef CONFIG_GENERIC_BUG_RELATIVE_POINTERS - file = bug->file; + file = bug->file; #else - file = (const char *)bug + bug->file_disp; + file = (const char *)bug + bug->file_disp; #endif - line = bug->line; + line = bug->line; #endif - warning = (bug->flags & BUGFLAG_WARNING) != 0; - once = (bug->flags & BUGFLAG_ONCE) != 0; - done = (bug->flags & BUGFLAG_DONE) != 0; - - if (warning && once) { - if (done) - return BUG_TRAP_TYPE_WARN; - - /* - * Since this is the only store, concurrency is not an issue. - */ - bug->flags |= BUGFLAG_DONE; - } + warning = (bug->flags & BUGFLAG_WARNING) != 0; + once = (bug->flags & BUGFLAG_ONCE) != 0; + done = (bug->flags & BUGFLAG_DONE) != 0; + + if (warning && once) { + if (done) + return BUG_TRAP_TYPE_WARN; + + /* + * Since this is the only store, concurrency is not an issue. + */ + bug->flags |= BUGFLAG_DONE; } if (warning) { -- 2.30.2