OSDN Git Service

libbpf: Avoid double stores for success/failure case of ksym relocations
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Mon, 22 Nov 2021 23:57:32 +0000 (05:27 +0530)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 30 Nov 2021 23:48:14 +0000 (15:48 -0800)
commit0270090d396a8e7e7f42adae13fdfa48ffb85144
treec0dd5b0d7e0ee3bd07d2e6dea0f1cbf6e2a980ac
parentd4efb170861827290f7f571020001a60d001faaf
libbpf: Avoid double stores for success/failure case of ksym relocations

Instead, jump directly to success case stores in case ret >= 0, else do
the default 0 value store and jump over the success case. This is better
in terms of readability. Readjust the code for kfunc relocation as well
to follow a similar pattern, also leads to easier to follow code now.

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20211122235733.634914-3-memxor@gmail.com
tools/lib/bpf/gen_loader.c