From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C8C7C3B18B for ; Thu, 13 Feb 2020 15:48:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 045A720661 for ; Thu, 13 Feb 2020 15:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581608922; bh=lLtqOmb6ArOFmm28b9QmeMjMkS6NyDFvFIkExuqLrsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=XVLLMfiIJTFESgx9M+45B/pt48nD+rXOxZZSO3mo1uOLpdZTw3KiR7lx3CfcBNKM8 7xONS8WOcGxN8Kp3jLjrQER85dJnesHEqt6QQO1kkVm3kyPn/XRnH15jzU9Dn7AUDX rhm4oTKGjVbt2uh2qx6G47k02Fll+EisAOMuQ4Yg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729277AbgBMP0w (ORCPT ); Thu, 13 Feb 2020 10:26:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:39862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728899AbgBMPZD (ORCPT ); Thu, 13 Feb 2020 10:25:03 -0500 Received: from localhost (unknown [104.132.1.104]) (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 051B124693; Thu, 13 Feb 2020 15:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607503; bh=lLtqOmb6ArOFmm28b9QmeMjMkS6NyDFvFIkExuqLrsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvUaxORK5Kj4QP20lzmsMYmu1iH1sQqlhuVX6JqfMvP6ZPHaayaEzvTBMCo0OnNfh paaujLoZGjVPcihrKYNESB6Y2EY3QYrH6LA6Qa8PVPyvp+Djyhi4uV0P8MlP+lDEpP qxVm58u3ldnzgV3CotxESS6fxlygioT24MxZgqJM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amol Grover , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 4.14 059/173] tracing: Annotate ftrace_graph_notrace_hash pointer with __rcu Date: Thu, 13 Feb 2020 07:19:22 -0800 Message-Id: <20200213151948.709228320@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151931.677980430@linuxfoundation.org> References: <20200213151931.677980430@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: Amol Grover [ Upstream commit fd0e6852c407dd9aefc594f54ddcc21d84803d3b ] Fix following instances of sparse error kernel/trace/ftrace.c:5667:29: error: incompatible types in comparison kernel/trace/ftrace.c:5813:21: error: incompatible types in comparison kernel/trace/ftrace.c:5868:36: error: incompatible types in comparison kernel/trace/ftrace.c:5870:25: error: incompatible types in comparison Use rcu_dereference_protected to dereference the newly annotated pointer. Link: http://lkml.kernel.org/r/20200205055701.30195-1-frextrite@gmail.com Signed-off-by: Amol Grover Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin --- kernel/trace/ftrace.c | 2 +- kernel/trace/trace.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 6af28692f0f53..dd9fdb52e24ad 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -5147,7 +5147,7 @@ static const struct file_operations ftrace_notrace_fops = { static DEFINE_MUTEX(graph_lock); struct ftrace_hash __rcu *ftrace_graph_hash = EMPTY_HASH; -struct ftrace_hash *ftrace_graph_notrace_hash = EMPTY_HASH; +struct ftrace_hash __rcu *ftrace_graph_notrace_hash = EMPTY_HASH; enum graph_filter_type { GRAPH_FILTER_NOTRACE = 0, diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 17f36488d3c84..757bb1bffed99 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -869,7 +869,7 @@ extern void __trace_graph_return(struct trace_array *tr, #ifdef CONFIG_DYNAMIC_FTRACE extern struct ftrace_hash __rcu *ftrace_graph_hash; -extern struct ftrace_hash *ftrace_graph_notrace_hash; +extern struct ftrace_hash __rcu *ftrace_graph_notrace_hash; static inline int ftrace_graph_addr(struct ftrace_graph_ent *trace) { @@ -922,10 +922,14 @@ static inline void ftrace_graph_addr_finish(struct ftrace_graph_ret *trace) static inline int ftrace_graph_notrace_addr(unsigned long addr) { int ret = 0; + struct ftrace_hash *notrace_hash; preempt_disable_notrace(); - if (ftrace_lookup_ip(ftrace_graph_notrace_hash, addr)) + notrace_hash = rcu_dereference_protected(ftrace_graph_notrace_hash, + !preemptible()); + + if (ftrace_lookup_ip(notrace_hash, addr)) ret = 1; preempt_enable_notrace(); -- 2.20.1