Skip to content

Commit a734fb5

Browse files
l0kodacmel
authored andcommitted
samples/bpf: Reset global variables
Before loading a new ELF, clean previous kernel version, license and processed sections. Signed-off-by: Mickaël Salaün <[email protected]> Acked-by: Joe Stringer <[email protected]> Acked-by: Wang Nan <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: David S. Miller <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 16ad132 commit a734fb5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

samples/bpf/bpf_load.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,11 @@ int load_bpf_file(char *path)
277277
Elf_Data *data, *data_prog, *symbols = NULL;
278278
char *shname, *shname_prog;
279279

280+
/* reset global variables */
281+
kern_version = 0;
282+
memset(license, 0, sizeof(license));
283+
memset(processed_sec, 0, sizeof(processed_sec));
284+
280285
if (elf_version(EV_CURRENT) == EV_NONE)
281286
return 1;
282287

0 commit comments

Comments
 (0)