Skip to contentSkip to conversation

libbpf: fix type compatibility check copy-paste error

PATCH Applied Andrii Nakryiko 2 participants 2 messages Aug 21, 2020 – Aug 24, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf: fix type compatibility check copy-paste error

Fix copy-paste error in types compatibility check. Local type is accidentally used instead of target type for the very first type check strictness check. This can result in potentially less strict candidate comparison. Fix the error.

Fixes 3fc32f40c402 ("libbpf: Implement type-based CO-RE relocations support")
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
index 210429c5b772..ea80a1582af6 100644
@@ -4603,7 +4603,7 @@ static int bpf_core_types_are_compat(const struct btf *local_btf, __u32 local_id
 
 	/* caller made sure that names match (ignoring flavor suffix) */
 	local_type = btf__type_by_id(local_btf, local_id);
-	targ_type = btf__type_by_id(local_btf, local_id);
+	targ_type = btf__type_by_id(targ_btf, targ_id);
 	if (btf_kind(local_type) != btf_kind(targ_type))
 		return 0;
 
Signature · 1 line
2.24.1
#1 lore raw
Quoted 8 lines · Andrii Nakryiko

Fix copy-paste error in types compatibility check. Local type is accidentally used instead of target type for the very first type check strictness check. This can result in potentially less strict candidate comparison. Fix the error.

Fixes 3fc32f40c402 ("libbpf: Implement type-based CO-RE relocations support")

Applied. Thanks