diff mbox series

arm: Elf32_Rel r_offset is unsigned, no need to check <0

Message ID 20191106113949.21782-1-ben.dooks@codethink.co.uk (mailing list archive)
State New, archived
Headers show
Series arm: Elf32_Rel r_offset is unsigned, no need to check <0 | expand

Commit Message

Ben Dooks Nov. 6, 2019, 11:39 a.m. UTC
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) <ben.dooks@codethink.co.uk>
---
Cc: Russell King <linux@armlinux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/kernel/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index deef17f34bd2..0921ce7e48d5 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -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);