From patchwork Wed Nov 6 11:39:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 11230067 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE73D15AB for ; Wed, 6 Nov 2019 11:40:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF9D92077C for ; Wed, 6 Nov 2019 11:40:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LLVe1G0o" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF9D92077C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=codethink.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Rhql/bnBdchKlFWzaah04zIi8TewzQ/y72EUc/I1t6E=; b=LLVe1G0oF0xVvj FnIPNA5lgA8HbLHEVOx8jG8GIJd6iAQ7AvhinKrWpythicbcSmTQJ031n2l5liUZHeRUi6pGbS2p6 8f6m8gX0bMo6YYlGlnnJTfycGFlrmEhsSPp02BD6P+aO9j5w9yfUXT4mdwl4jTyR7rDwCFLGqKptG RMV+LZ2a10N0m0MBn3fRjIAHu5T/3OSFAxTFwxW5aPygR5fqPRqZRZXMFisKL8qNd81mOxccexzgh v5fDCVDuXr6HhD0z65MYJATyObXBzyjypr0BKS8VENoZfrgr45rX2NFm1CSFdVvtRoneR0v81vWLj QXIZBHxaY9ANjtA1sR8g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSJfO-0000PI-9S; Wed, 06 Nov 2019 11:40:02 +0000 Received: from imap1.codethink.co.uk ([176.9.8.82]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSJfL-0000L0-0h for linux-arm-kernel@lists.infradead.org; Wed, 06 Nov 2019 11:40:00 +0000 Received: from [167.98.27.226] (helo=rainbowdash.codethink.co.uk) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1iSJfC-0008JC-HQ; Wed, 06 Nov 2019 11:39:50 +0000 Received: from ben by rainbowdash.codethink.co.uk with local (Exim 4.92.3) (envelope-from ) id 1iSJfC-0005g6-0E; Wed, 06 Nov 2019 11:39:50 +0000 From: "Ben Dooks (Codethink)" To: linux-kernel@lists.codethink.co.uk Subject: [PATCH] arm: Elf32_Rel r_offset is unsigned, no need to check <0 Date: Wed, 6 Nov 2019 11:39:49 +0000 Message-Id: <20191106113949.21782-1-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.24.0.rc1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191106_033959_203329_2EAF83CA X-CRM114-Status: GOOD ( 10.90 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [176.9.8.82 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Ben Dooks \(Codethink\)" , Russell King , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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) --- Cc: Russell King Cc: linux-arm-kernel@lists.infradead.org --- arch/arm/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);