]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
libkmod: Use correct data types
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 20 Oct 2024 09:38:56 +0000 (11:38 +0200)
committerLucas De Marchi <lucas.de.marchi@gmail.com>
Tue, 22 Oct 2024 17:02:56 +0000 (12:02 -0500)
A huge module file could contain more symbols than could be represented
with an int. Use size_t instead.

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/196
Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
libkmod/libkmod-elf.c

index c7d8ff50ec577aad311aec0d437e837d55a58204..a6ef5063bc67cc6518f61dd7313ac28b864e6d3c 100644 (file)
@@ -799,8 +799,8 @@ int kmod_elf_get_symbols(const struct kmod_elf *elf, struct kmod_modversion **ar
        const void *strtab, *symtab;
        struct kmod_modversion *a;
        char *itr;
-       size_t slen, symlen;
-       int i, count, symcount, err;
+       size_t i, count, symcount, slen, symlen;
+       int err;
 
        err = kmod_elf_get_section(elf, ".strtab", &strtab, &strtablen);
        if (err < 0) {
@@ -848,9 +848,8 @@ int kmod_elf_get_symbols(const struct kmod_elf *elf, struct kmod_modversion **ar
 #undef READV
                if (name_off >= strtablen) {
                        ELFDBG(elf,
-                              ".strtab is %" PRIu64
-                              " bytes, but .symtab entry %d wants to access offset %" PRIu32
-                              ".\n",
+                              ".strtab is %" PRIu64 " bytes, but .symtab entry %" PRIu64
+                              " wants to access offset %" PRIu32 ".\n",
                               strtablen, i, name_off);
                        goto fallback;
                }