Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4618390pxj; Wed, 12 May 2021 09:21:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzWkQ2nRaIZSDb++ng4e2p87wITjd1LE12ckfaCwblca4R7R4K/NzdVMDLnBTS4Ok/EAeA X-Received: by 2002:a50:cdd1:: with SMTP id h17mr44067663edj.178.1620836464969; Wed, 12 May 2021 09:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836464; cv=none; d=google.com; s=arc-20160816; b=IKLt1ixfmKUjFRN7kJLq8ZWTMJyPL4KfiJzYGueLv4o0Y0E4zPV+7IxYuQoARvV45C DB/kQwp2MrdAD/27FQQMep9nFwaipqCDEWmYSfoKRSGx+L3AJk2mSSjGX6MKyWM5hD7N rr+vi0VJ0l2BhIcsxn4yxX2b49hoU0u1cviMJBxEZkVERebXscn0C49H+o76EKemieJP UhXs+pxPrWgif+05ouoM+930oWG3+newtqfC7StOnKQeTuQbamQMsKz49TVMFZUW9fOr a1W18l1MVFfJ5zYN0+FwTMN5jYH8GEygeSPtXA1yEN6HmdrxK6yILpgWaKBBd4oDqtFd D3OQ== 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=tmwwsGAgb7DHSURHSuftQ1RKUC3YB/4Zmitt786ai8w=; b=P3EQg3i8aaCtZnzEHg9vuZqSixvGyx2nVAY+RqOaBqa34FgmqlOOREqtVp9M8JvWtW 8vn/gEaDP5HxF0ZlGaeFOdJL514ZciNurQwRm6l+QNScmG1e8/N7NyKbmxfoxBnoh+KU DeudfcrqlLI+1+02iki2tIGg5vKgqmO0sEkGrf/l7VVow7d1WwuaNaG4cbgPzgsuk6kc 5SaBaC1P97tMQtHTodsqvKeDvDOZ4eINVJd4U5l56hpuEGFTo77zg8MIYKQaR2NDc43N 0i7Ly86VevmkbztnN7vjfhJNQrTOconx7WEDpHEwq7CY0HzC3NKIdPkPuVCoxEgc7Y7p rZfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gGohGO0T; 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 dd28si297023ejb.696.2021.05.12.09.20.41; Wed, 12 May 2021 09:21:04 -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=gGohGO0T; 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 S233989AbhELQTC (ORCPT + 99 others); Wed, 12 May 2021 12:19:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:50220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235772AbhELPgD (ORCPT ); Wed, 12 May 2021 11:36:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6FF6361C42; Wed, 12 May 2021 15:18:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832687; bh=QAgOEDi4NnazYvI/KqXHtLpuK1MRsxPE7gVBjG6Hc38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gGohGO0TbEzDscnxK11CiY00iRx7FtZhQEwzJKBIIpo5DCwpRmiGSUJnLZ6bqoQFG 7VBwZcmiIKb92/TzdQo9Z3AKN0sXppTiYZnw+N+yBjAbi60iQMvsfRMmif9Iw6tGON L+VUypOKdaeD7A7CgBQoEwbrkVZzW/bKJUw01bcU= 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 5.10 383/530] bug: Remove redundant condition check in report_bug Date: Wed, 12 May 2021 16:48:13 +0200 Message-Id: <20210512144832.357441679@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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 7103440c0ee1..4ab398a2de93 100644 --- a/lib/bug.c +++ b/lib/bug.c @@ -158,30 +158,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; } /* -- 2.30.2