From patchwork Wed Mar 23 07:35:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 12789502 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1085AC433EF for ; Wed, 23 Mar 2022 07:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242248AbiCWHhF (ORCPT ); Wed, 23 Mar 2022 03:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242247AbiCWHhE (ORCPT ); Wed, 23 Mar 2022 03:37:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B320650B3B; Wed, 23 Mar 2022 00:35:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4D420B81DC9; Wed, 23 Mar 2022 07:35:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD71FC340E8; Wed, 23 Mar 2022 07:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648020931; bh=xg2LKyfJIt1HConR63HWpTzukqqZmS0RPHcMQ4kZgqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AUb2ABHyZQqMFnfkQwUtP38uq9xjcLNGpoRVg7wUSlg8Kk3C8i30krEXO/5EpiEjo Xaei29SmRlq5k7JTp0sLSI46nC+E4q6eFIU9z+/0GROVXv2e7DvI7sWbUsFKLY3Xai 78A9xVrQgTaMkORAeLq8Hfk+GEesRpbHbtgmO4553kRFvwRIvz3LDrp/9FaJjmR2m1 XCNGKNzoXRHLKz0U9xFOweC9sIZ9q9fhQ1qv8mpw5t3N/fL1LlEHxp0ZabfCEuMEPf YA2XP3Np7uuKE0G3PlUvWK/6QBhk5O0RJPHtLySoN4FAqo9XeAyNmwPOGwmY08Dlg1 IQcI+vo9sDmxQ== From: Masami Hiramatsu To: Alexei Starovoitov , Andrii Nakryiko Cc: Dan Carpenter , kernel-janitors@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next 1/2] fprobe: Fix smatch type mismatch warning Date: Wed, 23 Mar 2022 16:35:26 +0900 Message-Id: <164802092611.1732982.12268174743437084619.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164802091567.1732982.1242854551611267542.stgit@devnote2> References: <164802091567.1732982.1242854551611267542.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net Fix the type mismatching warning of 'rethook_node vs fprobe_rethook_node' found by Smatch. Reported-by: Dan Carpenter Signed-off-by: Masami Hiramatsu --- kernel/trace/fprobe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c index 8b2dd5b9dcd1..63b2321b22a0 100644 --- a/kernel/trace/fprobe.c +++ b/kernel/trace/fprobe.c @@ -150,15 +150,15 @@ static int fprobe_init_rethook(struct fprobe *fp, int num) fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler); for (i = 0; i < size; i++) { - struct rethook_node *node; + struct fprobe_rethook_node *node; - node = kzalloc(sizeof(struct fprobe_rethook_node), GFP_KERNEL); + node = kzalloc(sizeof(*node), GFP_KERNEL); if (!node) { rethook_free(fp->rethook); fp->rethook = NULL; return -ENOMEM; } - rethook_add_node(fp->rethook, node); + rethook_add_node(fp->rethook, &node->node); } return 0; } From patchwork Wed Mar 23 07:35:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 12789503 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09474C433F5 for ; Wed, 23 Mar 2022 07:35:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242252AbiCWHhL (ORCPT ); Wed, 23 Mar 2022 03:37:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242260AbiCWHhK (ORCPT ); Wed, 23 Mar 2022 03:37:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0250552E4F; Wed, 23 Mar 2022 00:35:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 914B0616C2; Wed, 23 Mar 2022 07:35:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D6B6C340E8; Wed, 23 Mar 2022 07:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648020941; bh=VwRDMPlvyAW4+7bI8rwSaS3Cr1jEgSKAbPz996YPCOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EvYnmcL8BLIwWtsoMbZhQjCeaq7Grko4V1DERaMRMvp67WHDlMxcdAijkJkvOW4EV x9Cztwc9U2Wg1kNj+iHfOYN/MbxWKO9xe83v11Z2MtQTDRPAp3lJKPyxgmFQaMW9UH KsH8S01qERUdTbAU2k18m6Sq0iFhK7SrIpcyVPR1hMO+2m351Et1kpRUip7C2WEjlA ta5nESOJIIe3gpEVK1Pr7/vjj4NgTRD15OtUgyC7xl0MQlXp6i69D0AUceq3MuOAeW gbImUSFOOebjfWl2f3TL/U5MTUDBfz3tPNvnvxya0Vbu43HjRvXjXdJthKexrJfVmb SO1BknyyI4ZiQ== From: Masami Hiramatsu To: Alexei Starovoitov , Andrii Nakryiko Cc: Dan Carpenter , kernel-janitors@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Jiri Olsa , bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next 2/2] fprobe: Fix sparse warning for acccessing __rcu ftrace_hash Date: Wed, 23 Mar 2022 16:35:36 +0900 Message-Id: <164802093635.1732982.4938094876018890866.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164802091567.1732982.1242854551611267542.stgit@devnote2> References: <164802091567.1732982.1242854551611267542.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org X-Patchwork-Delegate: bpf@iogearbox.net Since ftrace_ops::local_hash::filter_hash field is an __rcu pointer, we have to use rcu_access_pointer() to access it. Reported-by: kernel test robot Signed-off-by: Masami Hiramatsu --- kernel/trace/fprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c index 63b2321b22a0..89d9f994ebb0 100644 --- a/kernel/trace/fprobe.c +++ b/kernel/trace/fprobe.c @@ -215,7 +215,7 @@ int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter * correctly calculate the total number of filtered symbols * from both filter and notfilter. */ - hash = fp->ops.local_hash.filter_hash; + hash = rcu_access_pointer(fp->ops.local_hash.filter_hash); if (WARN_ON_ONCE(!hash)) goto out;