arm: Elf32_Rel r_offset is unsigned, no need to check <0
PATCH 1/1 arm: Elf32_Rel r_offset is unsigned, no need to check <0
The Elf_Rel r_offset field is an Elf32_Word, which is defined to be an uint32_t, so unsigned. There is no need to check this is less than zero. Fix the following compiler warning:
arch/arm/kernel/module.c:95:21: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
Signed-off-by Ben Dooks (Codethink) <[email protected]>
---
Cc: Russell King <[email protected]>
Cc: [email protected]
--- arch/arm/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/module.c +1 -1
@@ -92,7 +92,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, sym = ((Elf32_Sym *)symsec->sh_addr) + offset; symname = strtab + sym->st_name; -if (rel->r_offset <0 || rel->r_offset > dstsec->sh_size -sizeof (u32)) { +if (rel->r_offset > dstsec->sh_size -sizeof (u32)) {pr_err ("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %d size %u\n" , module->name, relindex, i, symname, rel->r_offset, dstsec->sh_size);
Signature · 7 lines
2.24.0.rc1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel