summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2014-03-07 01:17:10 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2014-03-07 01:24:39 -0300
commitfea655dcb38b9b9cacfb52ed2da2445c204f8c7e (patch)
tree674331cb373398b21cc1581b657301a8f7ef6f77
parent632fb7b4634a540bb09af3b2004b3fe44cd4a214 (diff)
downloadkmod-fea655dcb38b9b9cacfb52ed2da2445c204f8c7e.tar.gz
libkmod-elf: Fix check by class in get_modversions()
Commit 51c409b ("Cache the offset of crc") unintentinally changed the comparison "if (elf->class & KMOD_ELF_32)" to "if (elf->class == KMOD_ELF_32)". This has been reported by Serge Voilokov <serge0x76@gmail.com>: On Raspberry PI elf->class equals KMOD_ELF_32|KMOD_ELF_LSB so valid condition should be (elf->class & KMOD_ELF_32) instead of (elf->class == KMOD_ELF_32). This fixes "modprobe --dump-modversions" failing on 32b systems.
-rw-r--r--libkmod/libkmod-elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c
index 1c11a24..53335f3 100644
--- a/libkmod/libkmod-elf.c
+++ b/libkmod/libkmod-elf.c
@@ -516,7 +516,7 @@ int kmod_elf_get_modversions(const struct kmod_elf *elf, struct kmod_modversion
assert_cc(sizeof(struct kmod_modversion64) ==
sizeof(struct kmod_modversion32));
- if (elf->class == KMOD_ELF_32)
+ if (elf->class & KMOD_ELF_32)
offcrc = sizeof(uint32_t);
else
offcrc = sizeof(uint64_t);