diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-02-28 16:07:55 -0300 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-02-28 16:07:55 -0300 |
commit | d98f2d32d1e663bfb7a069a1623de15df6be765d (patch) | |
tree | 38fce0798e261c1a2751081fdd003d29394d9a9e | |
parent | 22df456760cf9e42302235c82125c2eb578050b2 (diff) | |
download | kmod-d98f2d32d1e663bfb7a069a1623de15df6be765d.tar.gz |
Avoid sign-extension error on multiplication
Do not promote "idx * elf->header.section.entry_size" to int. Explicitly
cast the result to uint64_t so it's zero-extended.
-rw-r--r-- | libkmod/libkmod-elf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libkmod/libkmod-elf.c b/libkmod/libkmod-elf.c index 2f50ad2..90da89a 100644 --- a/libkmod/libkmod-elf.c +++ b/libkmod/libkmod-elf.c @@ -218,7 +218,7 @@ static inline const void *elf_get_section_header(const struct kmod_elf *elf, uin return NULL; } return elf_get_mem(elf, elf->header.section.offset + - idx * elf->header.section.entry_size); + (uint64_t)(idx * elf->header.section.entry_size)); } static inline int elf_get_section_info(const struct kmod_elf *elf, uint16_t idx, uint64_t *offset, uint64_t *size, uint32_t *nameoff) |