Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4688436pxj; Wed, 12 May 2021 10:55:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRYjF2djOYOo2OEZXxObZydskMH6NBF6fOFtku7upc9JRWvgedsdTwBXpq0dJ+rOWCDssV X-Received: by 2002:a19:ca11:: with SMTP id a17mr24961801lfg.271.1620842155754; Wed, 12 May 2021 10:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620842155; cv=none; d=google.com; s=arc-20160816; b=yPth9aytPPdIv9xJ3SguuVyAGYPL5lQH2SEsazEqu6xLMSLQM8AAlmM195dR48eVQp yOhwd1oExP170zbU/qbCItHwmhmwuqXwGcsEp0o7nrLL9ZKEavt41vhIiM0Cx9P77zQ8 KPUyZqOtttY1AiVdU/rMd4Q795OoUVDhMubfuXoDBZ6SC7Ejrro+3wIJc0WIYuwLcTz3 OcYPdXwoR7S6AlLA+VP1fMjfLFlD9MPhTb6bJKW6WUxFzvA4HhsFvT0uDxsfNaobbVr8 X3oYPfj7ZWggAxzzSzePtqiTD/P+5eBarjeEkIV8lJrFP54z4V0J3R/0infuyg8qiW0y OCmA== 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=X0PpZ06fm0p+FZ+J13LA6Q6uNaJ+Vx5hJPYf7ZfUEkEhPnYO401Noqsu5W84aov9Eh iyLJW9mGbqlvOAVLYw7FFWenJnMjjT/6nN4Fi1/v8RqcD9dK8igd5w2Sp+KdDwd1ApHL RlKip15Gw9kx61/wI6s7Jw/F3GYiH7x3DUr7qPGWb2AXT1gH3VAKlT9SgO5bCnDf9BoX 6Q4x9IlGSHmksuxRSiLt9gaNEZhMhRvzB+57oyiC2UuSX/3pJ+oUXvd9K3UQ/JwJFpMU gRUqRojL/FTLOj3XHQHG5fKAy2L7VYwU/G0EoMC+/ucWxp9uKfgfbEFdoAdMnPKk3EUE T6xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xd66T0ue; 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 o20si544802lfu.226.2021.05.12.10.55.25; Wed, 12 May 2021 10:55:55 -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=xd66T0ue; 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 S1349422AbhELRmE (ORCPT + 99 others); Wed, 12 May 2021 13:42:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:47836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238675AbhELQPO (ORCPT ); Wed, 12 May 2021 12:15:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BB17461D54; Wed, 12 May 2021 15:42:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620834156; bh=QAgOEDi4NnazYvI/KqXHtLpuK1MRsxPE7gVBjG6Hc38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xd66T0uezSeBZnlqy+vBoK3YIXAHy9+ENG2BoKSUqcbAs48lE8/1aFcHOV3qZz2/X WDBG5j+Oa2vCNiHBUuOXo75xis6EdSkoanR2ywbjv0eMJuYcmqsX+T1jHmioOXqQAI 5C58tyvRFuEtROenWJiP02QUVeEYm+HgwmO47xrQ= 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.11 430/601] bug: Remove redundant condition check in report_bug Date: Wed, 12 May 2021 16:48:27 +0200 Message-Id: <20210512144841.998843966@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144827.811958675@linuxfoundation.org> References: <20210512144827.811958675@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