fprobe: Fixes for Sparse and Smatch warnings
Subsystems (3)
Masami Hiramatsu
maintainercover fprobe: Fixes for Sparse and Smatch warnings
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) <[email protected]>
Masami Hiramatsu
maintainerPATCH 1/2 fprobe: Fix smatch type mismatch warning
Fix the type mismatching warning of 'rethook_node vs fprobe_rethook_node' found by Smatch.
--- kernel/trace/fprobe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/fprobe.c +3 -3
@@ -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 ; }
Masami Hiramatsu
maintainerPATCH 2/2 fprobe: Fix sparse warning for acccessing __rcu ftrace_hash
In reply to Masami HiramatsuSince ftrace_ops::local_hash::filter_hash field is an __rcu pointer, we have to use rcu_access_pointer() to access it.
--- kernel/trace/fprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/fprobe.c +1 -1
@@ -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;
This series was applied to bpf/bpf.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <[email protected]>:
Quoted 9 lines · 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html