]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: Simplify elf_strip_section
authorTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 15 Oct 2024 14:18:55 +0000 (16:18 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Thu, 17 Oct 2024 14:21:31 +0000 (09:21 -0500)
It is always called with "__versions" as argument, so remove the
argument and rename function accordingly.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: https://github.com/kmod-project/kmod/pull/175
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-elf.c

index 80cc64cc8890a10cb9c101962d0ed7c215799259..c8193561cd906926be8694c39414c6cdd87e7da7 100644 (file)
@@ -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;
        }