Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1634971ybv; Fri, 21 Feb 2020 00:42:54 -0800 (PST) X-Google-Smtp-Source: APXvYqz5xpVkFTQpg6XPronNVNS7KYwT4o6LskkvOzho1eQQEkE/Y/ogQcn523e801w0hLU3sILz X-Received: by 2002:a9d:7ac9:: with SMTP id m9mr26169555otn.80.1582274574029; Fri, 21 Feb 2020 00:42:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582274574; cv=none; d=google.com; s=arc-20160816; b=rsbNc6p7IqHUA4R2hB7xxcGX/FlRjZ7zt5CaslAUap0bBOzHXWn2VvW0kIVfVoVWrd rYG+wDezkS9/CiDoaMIDrWfwPt3uAjsipz1orgY/QCfxbGfcoh24dAguGIPPCPyLWq/5 xC5eV/oh2OvSopaTnzXFHijoYme3+EcVNnA5k/EVRIr7dNuqjHbJTBWWEEwKccC4voCO TBg4J8hGFSiHF8FCSMNLjJoiCtRKAYDxbZ7bA+8V8oBy6hhMqp9F+FndO33ZFVbWuvhS lMm2PNmddsBA4TUAVq1WL/lCZ1xhdehepQrdinNTDm9RV/2GAvZe6GC88b1g9JselKvY PX7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=S9NiBzO+4qdFcg03IUoWNFVKxq5wxILh/wEJLrYVXsw=; b=Xw6z7ZGC8GudWJIpCA8xmAVgIylRr8rJIpW/QdEc63/Lvu/0aiicqCU74c0osCVz1j 6JPRGwz2jpDfBwIB4HUEVy55dS11JqVkGjlvPpwY/gFWhOY6sgFVKmLQRtBUjSJVaQrG tnGvU1DbZuWkl9OBAZ3Wh05wriJ0CL7FHJNL0zjHPZPzsAGiZr6sAS7FerJT0OotL+Pd fUzAjkBFOzPIy+lOJA4GT2BmUdmTH22WT3SB1wIq2fxALCDvLgfxhIrxQMIZtSU/HtpF VYD1wXQFEY9BJGsDzv2yfXQogP+Q5gv8YnQ4HCny3CZ+u3bZXAEBs61lex3lahv5/kjd LbCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l7cSjNBR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t130si452662oib.202.2020.02.21.00.42.42; Fri, 21 Feb 2020 00:42:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=l7cSjNBR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730530AbgBUH5x (ORCPT + 99 others); Fri, 21 Feb 2020 02:57:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:57498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730677AbgBUH5u (ORCPT ); Fri, 21 Feb 2020 02:57:50 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1232C20578; Fri, 21 Feb 2020 07:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271870; bh=p0xUTStllf1KM5Nebaqnyuhwek0/TARRJ3Sz6gsZpqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l7cSjNBRc773IQHQ54qqiLRy0fmGSNZJ+9onA3hRfbQHSrMWOrBabp/9yYqQBn04J +aTCt19SOI0jdZlYS46UgydSs0aKIWpaORLWpPs8IdXYQxN8l9eYryVDhB2+55ybCZ caxAHUCAxTkeZgIWFeiYPpAXs+FJooUK2d2wIM9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , Randy Dunlap , David Sterba , Sasha Levin Subject: [PATCH 5.5 330/399] btrfs: separate definition of assertion failure handlers Date: Fri, 21 Feb 2020 08:40:55 +0100 Message-Id: <20200221072433.227703402@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Sterba [ Upstream commit 68c467cbb2f389b6c933e235bce0d1756fc8cc34 ] There's a report where objtool detects unreachable instructions, eg.: fs/btrfs/ctree.o: warning: objtool: btrfs_search_slot()+0x2d4: unreachable instruction This seems to be a false positive due to compiler version. The cause is in the ASSERT macro implementation that does the conditional check as IS_DEFINED(CONFIG_BTRFS_ASSERT) and not an #ifdef. To avoid that, use the ifdefs directly. There are still 2 reports that aren't fixed: fs/btrfs/extent_io.o: warning: objtool: __set_extent_bit()+0x71f: unreachable instruction fs/btrfs/relocation.o: warning: objtool: find_data_references()+0x4e0: unreachable instruction Co-developed-by: Josh Poimboeuf Signed-off-by: Josh Poimboeuf Reported-by: Randy Dunlap Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/ctree.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index ba7292435c14c..2e9f938508e9b 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -3108,17 +3108,21 @@ do { \ rcu_read_unlock(); \ } while (0) -__cold -static inline void assfail(const char *expr, const char *file, int line) +#ifdef CONFIG_BTRFS_ASSERT +__cold __noreturn +static inline void assertfail(const char *expr, const char *file, int line) { - if (IS_ENABLED(CONFIG_BTRFS_ASSERT)) { - pr_err("assertion failed: %s, in %s:%d\n", expr, file, line); - BUG(); - } + pr_err("assertion failed: %s, in %s:%d\n", expr, file, line); + BUG(); } -#define ASSERT(expr) \ - (likely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) +#define ASSERT(expr) \ + (likely(expr) ? (void)0 : assertfail(#expr, __FILE__, __LINE__)) + +#else +static inline void assertfail(const char *expr, const char* file, int line) { } +#define ASSERT(expr) (void)(expr) +#endif /* * Use that for functions that are conditionally exported for sanity tests but -- 2.20.1