Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4560252pxj; Wed, 12 May 2021 08:12:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys4hlMiJPhY7cnqFd9OCNfojspjZFwAOkYd+vIe/xl8ABR+Aub+exm51jIzYTJcJ2GMZ7U X-Received: by 2002:a05:6830:1f52:: with SMTP id u18mr18191320oth.298.1620832350942; Wed, 12 May 2021 08:12:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620832350; cv=none; d=google.com; s=arc-20160816; b=jVR9URR1sgvJErpG/FH8yR5DHmfWGd+dkQq/8GI9MV9k6Bp9QPtpUazphqS0XR9iTj +te6Abn9bar8AY7lkp2KfjziPd+BJK7zPGzNbpgbo10yMF314C50w40NxAeUMSIvIYOt GVXOQ2lCDAC/LOsmXcGupBwyhU1ii6K47Bu7wfrq7b9LHYwAnMI+gT6fvApfy6i6JCoZ GqZ5D4TSTVdSPuOkLTdNpjNULIhnBbm5Wcdc2yYzlKPOVSX/nYmD5jJ8t+bTBysKynyE PtNEq6u9bxojl/jynq3rO3dBSmBZc3LevmFu8rkHlcVFrDMZSY80okI9x4cCSACIIOUJ l2Pg== 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=usMBoDO+s33+Q0gxuJ4IN16IwKA2DP9XxU40q8hyJeo=; b=rsA/sxyVgAlXr6tOy7QETI2EO9268wPXbDBD/03civTmRiafLshSUSS6MxhirBgdIQ 55KkZ+LUnUPMay1nvMTcU/eAw/WquA7i0cW+b8nxDa6Isgf6h7n7XdPBL1X4Uban0xDM ikJIq1WMus2cXvrbdb+mg7k+V/YY0MQeuWu9wH3WnaMQmF6tc966baXKWaSZLier+UxB H/OUFmhPMEj1Bu/yfB/kPXaPQONtjxFtkL23K1JDdFJfRmwQ0AWMUGfSpqHRW5WazIy7 nHH/P/iTOHIAK9efdDF2CgL5kOsjL4bLpBVz54RaFpHA+mpths3J2IpasuPj7VA3seiC jmcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bFjgXRi7; 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 d6si164446oom.15.2021.05.12.08.12.16; Wed, 12 May 2021 08:12:30 -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=bFjgXRi7; 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 S232660AbhELPKR (ORCPT + 99 others); Wed, 12 May 2021 11:10:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:56304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233223AbhELPEw (ORCPT ); Wed, 12 May 2021 11:04:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1357C61942; Wed, 12 May 2021 14:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620831584; bh=IMZmoN1wKgtzZ4QSmEgjO5c6gd7NRBElSzGuO9gV0KE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bFjgXRi7Bm26UHo3Vq6S2EjqBqDDInyk7lK53GfNtByW57Hf6qZ+d9z2y97jOg18E 7S+wYxrYcpC2DSKCxIfDFCkoVxPDU3t5499M8Bb2hfyTRahc+GbHIDAvp09YY0h4yU fxKxswA1raAFDVyjvBe/+qrpYaHVTFJJofjTzZoo= 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.4 178/244] bug: Remove redundant condition check in report_bug Date: Wed, 12 May 2021 16:49:09 +0200 Message-Id: <20210512144748.691641688@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144743.039977287@linuxfoundation.org> References: <20210512144743.039977287@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 8c98af0bf585..c3aa22cbc876 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