Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit e569eb3

Browse files
00xcmhiramat
authored andcommitted
tracing/probes: fix error check in parse_btf_field()
btf_find_struct_member() might return NULL or an error via the ERR_PTR() macro. However, its caller in parse_btf_field() only checks for the NULL condition. Fix this by using IS_ERR() and returning the error up the stack. Link: https://lore.kernel.org/all/20240527094351.15687-1-clopez@suse.de/ Fixes: c440adf ("tracing/probes: Support BTF based data structure field access") Signed-off-by: Carlos López <clopez@suse.de> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
1 parent 6996467 commit e569eb3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

kernel/trace/trace_probe.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
554554
anon_offs = 0;
555555
field = btf_find_struct_member(ctx->btf, type, fieldname,
556556
&anon_offs);
557+
if (IS_ERR(field)) {
558+
trace_probe_log_err(ctx->offset, BAD_BTF_TID);
559+
return PTR_ERR(field);
560+
}
557561
if (!field) {
558562
trace_probe_log_err(ctx->offset, NO_BTF_FIELD);
559563
return -ENOENT;

0 commit comments

Comments
 (0)