Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp957523ybe; Wed, 11 Sep 2019 07:18:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqzF0kQN6mAfhm2fseEoLrsxaZRUWxn5MsCHZRiMFyfzyzq8ThiB2kKMBOCegUMmNlEI0bUb X-Received: by 2002:a17:906:2311:: with SMTP id l17mr29927605eja.12.1568211508336; Wed, 11 Sep 2019 07:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568211508; cv=none; d=google.com; s=arc-20160816; b=OgQD4U9ha5rABCxwnwlCe72mTeu0eZFXNXik5BYU/MrYGMKO/Auo82zHz5k+t+5G1p Uc3qlRor2weub/kMFivnCyI23X8s7PwwcBp5mXpsOasfHpU29fsBfLnhGqcC5e7ctRF7 /jssqzz1W3kDBSffO5kBEXZCEGI7BqpXEEQJypphHyA0YSD0+vvLZu6dJ4ZGszh0xmDH 100e9vS5Sx3byaBPjjm/qwLYjSPTojv8NJao2KqtW4m8I9mtXvFzE9TUqi9G/VqIBX84 VDmW5vBJcMn21UDxU9+vhR6OEW6/g8o4UI/6HZaaVbmobqr6nWEZ20as04ldwePcmD7m 5vQg== 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=pwI9Nj5vtGdzn5MvkjXpV83BoYE5sMntyDtos1t7hrk=; b=n8ksdqoKSwld3hBEmRjJZ6UTFHxE1+SxrPA0190Xah9zLzpRUkqbLezMA5YNoVEhZw vTtyQJ2ZucaGpSO0ILInnKL+6nOT3ruKJDv4qjikoZvAN3YIk6ieyhzWvpHu4w4KVulq 2jpXHR11KfCgI2bTZc98HUIoSSFYwfGS2pO0hgt+KXdC0nSKGBxxzf1hMjGA4YJZvL14 aHiBSW2CWG8gQQ1JmPzTdhqZVEwjmc5QZZhsx8xQmwHsgSl6onFup1Ij5Q+ZlNoVBiXl oWcy56uyMGaRYbd9bHhArvCsS62TEsvJ0Hx0F3uT8Grl+UmBln9+b9186M51BwTftH0+ q1zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MiDNR8b5; 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 h64si192369edd.196.2019.09.11.07.18.03; Wed, 11 Sep 2019 07:18:28 -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=MiDNR8b5; 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 S1728090AbfIKOQE (ORCPT + 99 others); Wed, 11 Sep 2019 10:16:04 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37350 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726058AbfIKOQD (ORCPT ); Wed, 11 Sep 2019 10:16:03 -0400 Received: by mail-pf1-f193.google.com with SMTP id y5so11004020pfo.4 for ; Wed, 11 Sep 2019 07:16:03 -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=pwI9Nj5vtGdzn5MvkjXpV83BoYE5sMntyDtos1t7hrk=; b=MiDNR8b5UQcE1rhM2uCd+Ka3gMWU2mmQI3g2DJQitzSEzCa3o69gPLwbEV4gi5T6Ci DKGVUEN1MPAqhyT22ldAeym832I0wB5sS0q3nq6kMoHqxbhJQv3PeOxASPkIQn8QBDOy u24zd3weX7xY/4kFfPk5R8bLtZDL7WU8/78TQifzn1tAi89M9r2m4C4KP/Q4FyD4wvRD QVoJE5Jfkbb9tx+uRV1ZxtD3GpQeSPx4pGzPP/8vG2EwfD4drfaMPxW9b7wdXUFkxoKL wGG+tdDcIq+9T9x5CvAjLEdndm9y2y65YlgrPD05+ZXStDrhdSP0WYw9rrI0DFN8hkwH jBWg== 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=pwI9Nj5vtGdzn5MvkjXpV83BoYE5sMntyDtos1t7hrk=; b=bLxJzn+scNGnemtxBj0PZqbx+Yf/QJq/MgRL9SQF5I4HGXbvb7b0iY2A/CU5JGcXd3 tY0GMdQzeB4OhM8P578W1/IR8vTLKRq5DyPumVlsAN54VUdPodSIgivWxi0mWMZ/MnGr 6zin/BNQCv69an5yAWtTtYeN7vOw8j4XE0NQ2t1vZPHfDLOAArDxRdBhSCVZVCp9iPrW fDhqY3URI4ZV80k+KaUvJHxhhZ2TFolEDhO0a4Ye/YLpXaDKNUAH0UJNPqj+Xn53f2OA PWzpvv1H/bo+3kQpDkSJR2Mjn+iStwanF4qy3KBs9o0GZYgghUnlxaaJpS+viV8TAfT8 gg4g== X-Gm-Message-State: APjAAAWoAH5yUbvFU+qrGpVFKsz8ZmFf7kqQdYaZaIddhH9CEP5HlOhP eF8z8Ntn/5jSryb8tRYv9o4uNTKiLGciCQ== X-Received: by 2002:a17:90a:ae15:: with SMTP id t21mr5781382pjq.50.1568211362448; Wed, 11 Sep 2019 07:16:02 -0700 (PDT) Received: from raspberrypi ([210.183.35.47]) by smtp.gmail.com with ESMTPSA id w13sm23185858pfi.30.2019.09.11.07.16.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2019 07:16:01 -0700 (PDT) Date: Wed, 11 Sep 2019 23:15:55 +0900 From: Austin Kim To: linux@armlinux.org.uk, allison@lohutok.net, info@metux.net, matthias.schiffer@ew.tq-group.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, austindh.kim@gmail.com Subject: [RESEND PATCH] ARM: module: Drop 'rel->r_offset < 0' statement Message-ID: <20190911141552.rtpdazx3ekfgsh3v@raspberrypi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since rel->r_offset is declared as Elf32_Addr, this value is always non-negative. typedef struct elf32_rel { Elf32_Addr r_offset; Elf32_Word r_info; } Elf32_Rel; typedef __u32 Elf32_Addr; typedef unsigned int __u32; Drop 'rel->r_offset < 0' statement which is always false. Also change %u to %d in pr_err() for rel->r_offset. Signed-off-by: Austin Kim --- arch/arm/kernel/module.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index deef17f34..f805bcbda 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -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.11.0