Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4744429pxj; Wed, 12 May 2021 12:13:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxthUAWYHfWTBN+iz6h9IVqnV3QnWbGRmkXGPbVOknE+jizuxM7oJeI3c3mFPiZWdwddUTA X-Received: by 2002:aa7:d14e:: with SMTP id r14mr44385725edo.119.1620846789455; Wed, 12 May 2021 12:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620846789; cv=none; d=google.com; s=arc-20160816; b=fmFuB2FGGo81NABmjwzjpiT3W05Qs4P1qgcj6ZhI0Krs4qYm4VPmyG1LLF4NnUtXEM 9R/j941Z0mrDKz5hFlXYpGEkBzH6GSiY6owT2ACbRyWBbvnXET89otrDvy8PEIoAXRpw rxp8arpFvoNwjP1ddxRwKxpt96kI2JHrGqo+KBnucIPuzY5YuUrWe9nf/7nLFES81jgm KgFGRo8rBqydfmGh2RS1Udpx7pKg97t9rw+YBYWcjFNKhP04W9ZsZTon//9Xl0kZ3XbR UIEmtyE8sKsLlM6yynpQuO7jPGLDNotHRKETghpGUoFbZEmggJWyRWeQZSr8BwbTqnzF JAtg== 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=VPwR3V0QnK69JV/MYyjafH0Vy26Mq2tGPSQmmPWSVJ8=; b=S4INoICw97tfDVMMBptEschrk29RwAkC7T/Ug4BAdxo5O3w6LACcnYMeTKMclxQpCl C2Q9cMOGhq6CAPIozzu8wkeBgQPwiKbZ5bmN1r8Vz/V/lxuyduJ5sb58pbGW/6KKmRAw Ql1qg1MG8bcbGE2IPVuaCXFFBkcIOdadUkeDqju6q1JgxdaU6StKC6A6uUy4hrA5kU16 o4KVxTtf60SVuWsomlv5d92Yu5sJZ2ENYPLpvz1iHUxwwrbYIu9n9bEnKPindrVJHuGw E+PXR3zES0TdmZgAqFQZd/pJgQPv8ul6TahyzYJfbVpNlJk4Xjn/xaGQcTiS8vi56kJB 9tCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CRSbVDii; 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 bi14si158102ejb.441.2021.05.12.12.12.45; Wed, 12 May 2021 12:13:09 -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=CRSbVDii; 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 S1376466AbhELSyt (ORCPT + 99 others); Wed, 12 May 2021 14:54:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:35834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244046AbhELQm3 (ORCPT ); Wed, 12 May 2021 12:42:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8563261D0E; Wed, 12 May 2021 16:09:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620835791; bh=Kx1zeWwfzwRSt+og8jdQBRYacenx8K7yssoh5PQB0ms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CRSbVDiiegaVV1SdlnHlsMiEaj2PLPhDcb+rFnl7tXh5LYv13UL6DwIEAs973JS5/ S7hei0Dv/jgpaumYhX2oq4IwArTUQWRp/olhkxFOUGxQHM2tKDFA7QX+pcUsTz1eHx N7oLcoyonydwnJI1xGgyjc0wck/ZaUpeB5uw+4k0= 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.12 485/677] bug: Remove redundant condition check in report_bug Date: Wed, 12 May 2021 16:48:51 +0200 Message-Id: <20210512144853.486121360@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144837.204217980@linuxfoundation.org> References: <20210512144837.204217980@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 8f9d537bfb2a..b92da1f6e21b 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; } /* -- 2.30.2