Skip to contentSkip to conversation

btf_encoder: ensure elf function representation is fully initialized

PATCH Applied Alan Maguire 3 participants 3 messages Feb 8, 2023 – Feb 9, 2023 BPF

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btf_encoder: ensure elf function representation is fully initialized

new fields in BTF encoder state (used to support save and later addition of function) of ELF function representation need to be initialized. No need to set parameter names to NULL as got_parameter_names guards their use.

A follow-on patch intended to be applied after the series [1].

[1] https://lore.kernel.org/bpf/[email protected]/

---
 btf_encoder.c | 2 ++
 1 file changed, 2 insertions(+)
btf_encoder.c +2 -0
index 35fb60a..ea5b47b 100644
@@ -1020,6 +1020,8 @@ static int btf_encoder__collect_function(struct btf_encoder *encoder, GElf_Sym *
 	}
 	encoder->functions.entries[encoder->functions.cnt].generated = false;
 	encoder->functions.entries[encoder->functions.cnt].function = NULL;
+	encoder->functions.entries[encoder->functions.cnt].state.got_parameter_names = false;
+	encoder->functions.entries[encoder->functions.cnt].state.type_id_off = 0;
 	encoder->functions.cnt++;
 	return 0;
 }
Signature · 1 line
1.8.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Alan Maguire

new fields in BTF encoder state (used to support save and later addition of function) of ELF function representation need to be initialized. No need to set parameter names to NULL as got_parameter_names guards their use.

A follow-on patch intended to be applied after the series [1].

[1] https://lore.kernel.org/bpf/[email protected]/

thanks,
jirka

Quoted 20 lines
---
 btf_encoder.c | 2 ++
 1 file changed, 2 insertions(+)
btf_encoder.c +2 -0
index 35fb60a..ea5b47b 100644
@@ -1020,6 +1020,8 @@ static int btf_encoder__collect_function(struct btf_encoder *encoder, GElf_Sym *
 	}
 	encoder->functions.entries[encoder->functions.cnt].generated = false;
 	encoder->functions.entries[encoder->functions.cnt].function = NULL;
+	encoder->functions.entries[encoder->functions.cnt].state.got_parameter_names = false;
+	encoder->functions.entries[encoder->functions.cnt].state.type_id_off = 0;
 	encoder->functions.cnt++;
 	return 0;
 }
Signature · 1 line
1.8.3.1
#2 lore raw

Em Thu, Feb 09, 2023 at 10:36:39AM +0100, Jiri Olsa escreveu:

Quoted 6 lines · Alan Maguire
Quoted 5 lines

new fields in BTF encoder state (used to support save and later addition of function) of ELF function representation need to be initialized. No need to set parameter names to NULL as got_parameter_names guards their use.

Quoted 8 lines
Quoted 6 lines

A follow-on patch intended to be applied after the series [1].

[1] https://lore.kernel.org/bpf/[email protected]/

Thanks, applied.

- Arnaldo

Quoted 23 lines

thanks,
jirka

Quoted 20 lines
---
 btf_encoder.c | 2 ++
 1 file changed, 2 insertions(+)
btf_encoder.c +2 -0
index 35fb60a..ea5b47b 100644
@@ -1020,6 +1020,8 @@ static int btf_encoder__collect_function(struct btf_encoder *encoder, GElf_Sym *
 	}
 	encoder->functions.entries[encoder->functions.cnt].generated = false;
 	encoder->functions.entries[encoder->functions.cnt].function = NULL;
+	encoder->functions.entries[encoder->functions.cnt].state.got_parameter_names = false;
+	encoder->functions.entries[encoder->functions.cnt].state.type_id_off = 0;
 	encoder->functions.cnt++;
 	return 0;
 }
Signature · 1 line
1.8.3.1
Signature · 1 line
- Arnaldo