From: Tobias Stoeckmann Date: Sun, 20 Oct 2024 09:38:56 +0000 (+0200) Subject: libkmod: Use correct data types X-Git-Tag: v34~196 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b000028d353510fca017b667bbca3f467b2a832e;p=thirdparty%2Fkmod.git libkmod: Use correct data types A huge module file could contain more symbols than could be represented with an int. Use size_t instead. Signed-off-by: Tobias Stoeckmann Reviewed-by: Emil Velikov Link: https://github.com/kmod-project/kmod/pull/196 Signed-off-by: Lucas De Marchi --- diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index c7d8ff50..a6ef5063 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -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; }