From 226d7af2b02e6988396f2a8d02a4fcccbc229fcf Mon Sep 17 00:00:00 2001 From: Tobias Stoeckmann Date: Tue, 15 Oct 2024 16:18:55 +0200 Subject: [PATCH] libkmod: Simplify elf_strip_section It is always called with "__versions" as argument, so remove the argument and rename function accordingly. Signed-off-by: Tobias Stoeckmann Reviewed-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/175 Signed-off-by: Lucas De Marchi --- libkmod/libkmod-elf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 80cc64cc..c8193561 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -564,12 +564,11 @@ int kmod_elf_get_modversions(const struct kmod_elf *elf, struct kmod_modversion return count; } -static int elf_strip_section(const struct kmod_elf *elf, const char *section, - uint8_t *changed) +static int elf_strip_versions_section(const struct kmod_elf *elf, uint8_t *changed) { uint64_t off, size; const void *buf; - int idx = elf_find_section(elf, section); + int idx = elf_find_section(elf, "__versions"); uint64_t val; if (idx < 0) @@ -657,7 +656,7 @@ const void *kmod_elf_strip(const struct kmod_elf *elf, unsigned int flags) ELFDBG(elf, "copied memory to allow writing.\n"); if (flags & KMOD_INSERT_FORCE_MODVERSION) { - err = elf_strip_section(elf, "__versions", changed); + err = elf_strip_versions_section(elf, changed); if (err < 0) goto fail; } -- 2.47.2