All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] fprobe: Fixes for Sparse and Smatch warnings
@ 2022-03-23  7:35 Masami Hiramatsu
  2022-03-23  7:35 ` [PATCH bpf-next 1/2] fprobe: Fix smatch type mismatch warning Masami Hiramatsu
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2022-03-23  7:35 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko
  Cc: Dan Carpenter, kernel-janitors, Steven Rostedt, Masami Hiramatsu,
	Jiri Olsa, bpf, linux-kernel

Hi,

These fprobe patches are for fixing the warnings by Smatch and sparse.
This is arch independent part of the fixes.


Thank you,

---

Masami Hiramatsu (2):
      fprobe: Fix smatch type mismatch warning
      fprobe: Fix sparse warning for acccessing __rcu ftrace_hash


 kernel/trace/fprobe.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--
Masami Hiramatsu (Linaro) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH bpf-next 1/2] fprobe: Fix smatch type mismatch warning
  2022-03-23  7:35 [PATCH bpf-next 0/2] fprobe: Fixes for Sparse and Smatch warnings Masami Hiramatsu
@ 2022-03-23  7:35 ` Masami Hiramatsu
  2022-03-23  7:35 ` [PATCH bpf-next 2/2] fprobe: Fix sparse warning for acccessing __rcu ftrace_hash Masami Hiramatsu
  2022-03-29  2:20 ` [PATCH bpf-next 0/2] fprobe: Fixes for Sparse and Smatch warnings patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2022-03-23  7:35 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko
  Cc: Dan Carpenter, kernel-janitors, Steven Rostedt, Masami Hiramatsu,
	Jiri Olsa, bpf, linux-kernel

Fix the type mismatching warning of 'rethook_node vs fprobe_rethook_node'
found by Smatch.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 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;
 }


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH bpf-next 2/2] fprobe: Fix sparse warning for acccessing __rcu ftrace_hash
  2022-03-23  7:35 [PATCH bpf-next 0/2] fprobe: Fixes for Sparse and Smatch warnings Masami Hiramatsu
  2022-03-23  7:35 ` [PATCH bpf-next 1/2] fprobe: Fix smatch type mismatch warning Masami Hiramatsu
@ 2022-03-23  7:35 ` Masami Hiramatsu
  2022-03-29  2:20 ` [PATCH bpf-next 0/2] fprobe: Fixes for Sparse and Smatch warnings patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2022-03-23  7:35 UTC (permalink / raw)
  To: Alexei Starovoitov, Andrii Nakryiko
  Cc: Dan Carpenter, kernel-janitors, Steven Rostedt, Masami Hiramatsu,
	Jiri Olsa, bpf, linux-kernel

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 <lkp@intel.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 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;
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf-next 0/2] fprobe: Fixes for Sparse and Smatch warnings
  2022-03-23  7:35 [PATCH bpf-next 0/2] fprobe: Fixes for Sparse and Smatch warnings Masami Hiramatsu
  2022-03-23  7:35 ` [PATCH bpf-next 1/2] fprobe: Fix smatch type mismatch warning Masami Hiramatsu
  2022-03-23  7:35 ` [PATCH bpf-next 2/2] fprobe: Fix sparse warning for acccessing __rcu ftrace_hash Masami Hiramatsu
@ 2022-03-29  2:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-29  2:20 UTC (permalink / raw)
  To: Masami Hiramatsu
  Cc: ast, andrii.nakryiko, dan.carpenter, kernel-janitors, rostedt,
	jolsa, bpf, linux-kernel

Hello:

This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 23 Mar 2022 16:35:15 +0900 you wrote:
> Hi,
> 
> These fprobe patches are for fixing the warnings by Smatch and sparse.
> This is arch independent part of the fixes.
> 
> 
> Thank you,
> 
> [...]

Here is the summary with links:
  - [bpf-next,1/2] fprobe: Fix smatch type mismatch warning
    https://git.kernel.org/bpf/bpf/c/9052e4e83762
  - [bpf-next,2/2] fprobe: Fix sparse warning for acccessing __rcu ftrace_hash
    https://git.kernel.org/bpf/bpf/c/261608f3105c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-29  2:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23  7:35 [PATCH bpf-next 0/2] fprobe: Fixes for Sparse and Smatch warnings Masami Hiramatsu
2022-03-23  7:35 ` [PATCH bpf-next 1/2] fprobe: Fix smatch type mismatch warning Masami Hiramatsu
2022-03-23  7:35 ` [PATCH bpf-next 2/2] fprobe: Fix sparse warning for acccessing __rcu ftrace_hash Masami Hiramatsu
2022-03-29  2:20 ` [PATCH bpf-next 0/2] fprobe: Fixes for Sparse and Smatch warnings patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.