Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp6538037ybn; Sun, 29 Sep 2019 22:53:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQgph/MngCQUNlFB4CE3jswww0Zi/xFl79478dy+u07Keu8T1AdFEaW8L89gMh2q8PrUhP X-Received: by 2002:a50:aa8e:: with SMTP id q14mr17946355edc.155.1569822796244; Sun, 29 Sep 2019 22:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569822796; cv=none; d=google.com; s=arc-20160816; b=Vil0e5dYwboLWjKtT+iRCMK2lGH5YNw/C1cCuSGgngt0gQvFiff6LAYIPE9d751q4o gRdT5IaqZaPhmfESBqD/FwCH/6O/SFPh1S+yfD3O/6sJkwwars6+br7xzuSEvPzJqHr3 BsG04maKIXNT+avW8R9MmTNphkM/6qzjvc35z9GJI4TnB+sEgWP133BSN/PL7YnK52oJ 57FMzr/LZ/gd8QSJEFpFBl9U43oRoybjPVR1O+MJzf3K2TSgd02QRqMc9d9Ik33qPVPP 0b6JcNeD3yvRnXXPulPTQr7h0P7ZUW2iH0qmqa9HBI5PGgOOSE74jnJhV7F3dOCDLkuo M+3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=nTyKTixdmn3fWlZSMKqI+ME67BJO0vwEvb6x4HC5OpA=; b=kkEjPwmbwDk5SFVb9D0xUoo7gT+zYdWha/E4f8Pyku/wTrfr1TJ1KigMVvVtdYkS1v McoF84IWUDfVSWts1LLiSF4sobQyt8TmXSfC/c6NP86Tv9hsz5vExT2cM+ZredpLe950 q6wt4O7krHfePiS8vw6KJbN0tsnGOpiVlZFnuqv3uQaTt/n73eT8mBu3lX9knDbsSXzO qyoY3f9F3J2bkCI/1mYwjy/LZBkRrAv2BKR0r8UZzjTA+cn8MPekKX2Wh5vndRqtAv28 KAymtMQ78Z47TwJMovgPo36aBej9Et74OxvMBImh+yozGzPxuES2Y+y3IR0ljkwthmzL 1ZQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XdzDhpGk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gz11si6498623ejb.341.2019.09.29.22.52.51; Sun, 29 Sep 2019 22:53:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XdzDhpGk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729613AbfI3FtL (ORCPT + 99 others); Mon, 30 Sep 2019 01:49:11 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:44738 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726032AbfI3FtK (ORCPT ); Mon, 30 Sep 2019 01:49:10 -0400 Received: by mail-pg1-f196.google.com with SMTP id i14so6720809pgt.11 for ; Sun, 29 Sep 2019 22:49:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=nTyKTixdmn3fWlZSMKqI+ME67BJO0vwEvb6x4HC5OpA=; b=XdzDhpGktBu9KaisAZm5uiKRmQbIqKunbhGVDriAwdnFxah4atpIE4Er5OCMKKjLYg cu+dCHuDTPEXhnn8YKSPzHdxUifL9f+2h6ICQ/E+H1r6oc3RlARBPwpIbefwsnnW9IDY 2+jlmkxJYZ/ldIktJ/rGsLKM3ooTXzDgNebQYKkEWbDUs63PEXYeYwshiyqYP9el9Oqf 06fBkx4fdllMofVZCZjtI+yjsFYV4/opxtSB33YZuLyw6NniR3mgH7I/hkXpzCcmTD2j LYXujFZMYgxDITvP93e5gZxBkLp6ks+AnrGUj0zIA33/mT1AAhCj9RcjocfvBGEbaTaS r6Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=nTyKTixdmn3fWlZSMKqI+ME67BJO0vwEvb6x4HC5OpA=; b=BnfSXjITxGGqtGvLHRDWcMSPWFVmdKNnsFrkALUfLRyAA0w0suKYwLyX1Vd8vzlEAE nfDvCjDgDvbxWYk6iX4sqbvbOQuNJpPagl2MO9vojhp1xw37YxSEK+R2kSitO/IlCXV9 0mtcXHL0u1up5YkgBcnnCRz8gHL0Vf6ZxPj4CLwe85vURrH/lM9jpjQoZoRbwxqzLkM7 A1RTKYXSot1co0sshXH2eyFHA7UDYuYgLUiTAM4mSv1o+5P4hVlvuusyCDaz3g1AJSqZ qZt70vo9dTifhqsF5zYtZs+jq2tAV4XPtW1oX4orahuvDI09C41bP7M9IBeICJVoIOH4 PGUg== X-Gm-Message-State: APjAAAVXS2gWUi2Q3sLB/Ct1c5D47DB47dxKAZppnT+STAGzUbDP+GMn 04h/r6TGp41XRqCCccpEnJ3wCyxPzbc= X-Received: by 2002:a17:90a:284c:: with SMTP id p12mr25077366pjf.87.1569822549796; Sun, 29 Sep 2019 22:49:09 -0700 (PDT) Received: from LGEARND20B15 ([27.122.242.75]) by smtp.gmail.com with ESMTPSA id 8sm12551272pgd.87.2019.09.29.22.49.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Sep 2019 22:49:09 -0700 (PDT) Date: Mon, 30 Sep 2019 14:49:03 +0900 From: Austin Kim To: linux@armlinux.org.uk, info@metux.net, arnd@arndb.de, allison@lohutok.net Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, austindh.kim@gmail.com Subject: [PATCH] ARM: module: remove 'always false' statement Message-ID: <20190930054903.GA12163@LGEARND20B15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The each field of 'struct elf32_rel' is declared as below. typedef struct elf32_rel { Elf32_Addr r_offset; Elf32_Word r_info; } Elf32_Rel; typedef __u32 Elf32_Addr; typedef __u32 Elf32_Word; This means that 'r_offset' and 'r_info' could contain non-negative value. So 'always false' statement can be dropped. Signed-off-by: Austin Kim --- arch/arm/kernel/module.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index deef17f..617de32 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -83,7 +83,7 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex, #endif offset = ELF32_R_SYM(rel->r_info); - if (offset < 0 || offset > (symsec->sh_size / sizeof(Elf32_Sym))) { + if (offset > (symsec->sh_size / sizeof(Elf32_Sym))) { pr_err("%s: section %u reloc %u: bad relocation sym offset\n", module->name, relindex, i); return -ENOEXEC; @@ -92,8 +92,8 @@ 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)) { - pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %d size %u\n", + if (rel->r_offset > dstsec->sh_size - sizeof(u32)) { + pr_err("%s: section %u reloc %u sym '%s': out of bounds relocation, offset %u size %u\n", module->name, relindex, i, symname, rel->r_offset, dstsec->sh_size); return -ENOEXEC; -- 2.6.2