From: Tobias Stoeckmann Date: Tue, 15 Oct 2024 14:18:55 +0000 (+0200) Subject: libkmod: Simplify elf_strip_section X-Git-Tag: v34~227 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=226d7af2b02e6988396f2a8d02a4fcccbc229fcf;p=thirdparty%2Fkmod.git 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 --- 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; }