trace: bpf: Fix passing zero to PTR_ERR()
Subsystems (6)
PATCH v3 1/1 trace: bpf: Fix passing zero to PTR_ERR()
There is a bug when passing zero to PTR_ERR() and return. Fix smatch err.
Signed-off-by Wang Qing <[email protected]>
--- kernel/trace/bpf_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/bpf_trace.c +1 -1
@@ -1198,7 +1198,7 @@ static int bpf_btf_printf_prepare(struct btf_ptr *ptr, u32 btf_ptr_size, *btf =bpf_get_btf_vmlinux ();if (IS_ERR_OR_NULL (*btf)) -return PTR_ERR (*btf); +return IS_ERR (*btf) ?PTR_ERR (*btf) : -EINVAL ;if (ptr->type_id >0 ) *btf_id = ptr->type_id;
Signature · 1 line
2.7.4
Quoted 4 lines · Wang Qing
There is a bug when passing zero to
PTR_ERR()and return. Fix smatch err.Signed-off-by Wang Qing <[email protected]>
Acked-by Yonghong Song <[email protected]>
Quoted 24 lines · Wang Qing
There is a bug when passing zero to
PTR_ERR()and return. Fix smatch err.Signed-off-by Wang Qing <[email protected]>--- kernel/trace/bpf_trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/trace/bpf_trace.c +1
-1@@ -1198,7 +1198,7 @@ static int bpf_btf_printf_prepare(struct btf_ptr *ptr, u32 btf_ptr_size, *btf =bpf_get_btf_vmlinux ();if (IS_ERR_OR_NULL (*btf)) -return PTR_ERR (*btf); +return IS_ERR (*btf) ?PTR_ERR (*btf) : -EINVAL ;if (ptr->type_id >0 ) *btf_id = ptr->type_id;Signature · 1 line
2.7.4
Acked-by John Fastabend <[email protected]>