Skip to content

Commit abbaa43

Browse files
Wang Qingborkmann
Wang Qing
authored andcommitted
bpf: Fix passing zero to PTR_ERR() in bpf_btf_printf_prepare
There is a bug when passing zero to PTR_ERR() and return. Fix the smatch error. Fixes: c4d0bfb ("bpf: Add bpf_snprintf_btf helper") Signed-off-by: Wang Qing <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Yonghong Song <[email protected]> Acked-by: John Fastabend <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 197afc6 commit abbaa43

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/bpf_trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ static int bpf_btf_printf_prepare(struct btf_ptr *ptr, u32 btf_ptr_size,
11981198
*btf = bpf_get_btf_vmlinux();
11991199

12001200
if (IS_ERR_OR_NULL(*btf))
1201-
return PTR_ERR(*btf);
1201+
return IS_ERR(*btf) ? PTR_ERR(*btf) : -EINVAL;
12021202

12031203
if (ptr->type_id > 0)
12041204
*btf_id = ptr->type_id;

0 commit comments

Comments
 (0)