Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4397328ybv; Sun, 16 Feb 2020 21:29:40 -0800 (PST) X-Google-Smtp-Source: APXvYqwwiaxHnwmcI85zKm37QGgHpXDysLOThjrdHNCxEAVIfru8Fo6IO0fXsnCUgQbl3oftHLQx X-Received: by 2002:a9d:dc1:: with SMTP id 59mr11062228ots.250.1581917380547; Sun, 16 Feb 2020 21:29:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581917380; cv=none; d=google.com; s=arc-20160816; b=d/opG8LAWW8/7uCpOX+BOgh1NmbV+TmfM7jP8EaLsf+hMwn4P0KcZ06z9svYQ1xwNP E790obK/CBd/pcyUnUphBYtrDk6yTMT3Ox3MT4/PYm215Nv3bdZ4JAS0f5SrMvtlsu3p cfRjhUzYs0gWKPmg/hrrnJT3tck9vnB8eyhlrZW1haSdXrgfBqgsW86XSApJjUG1yel9 I/kUVkp2fZCKvPyrFBjzYSx+hrVPhKixbTb/I4oOaaULxmfyVAQyZZrAL8LKaKkqEhDG sWJWPcWdA/yfG/0uA15r1ZNeHdD5FVb+C98Z3LYiYEdKamAQckjxzAoj1ePONkdP6YDk aGyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=6EOwBWQiSYPuJXGqb5TNgNzXZTK4hiPUmJVB5CpC4Pc=; b=Blu+CtPhOP6sO9duLCO0vf5zX+Po46pjHAL4hE+UuggHvy90mX3MlQlqmgF6X1uO/3 FLzBDDu/GvRo+2uzjR8DrjHADMWLw5kemcUhCguhrHU1NWHsq8seYrUocI6xLuVzZOGo hjhrCLKtZTrqH0EwMThGjhITX69RswmkCVeauKofCvg09zRy7fTADgdpp5yONT+0oAS5 qLygi/WD0ul5akI6p0OJBmIqQ+SA04pjUr2mxCtCfrD2CXftTsYQhni2UniYP6zrlh6X ELzx3gsN+eFTBevNr/SHEUyuvjdY8UCoAwKLMBpcYanu0JzOusfWBnLSaNhVBb7vanzo qZkg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h139si5926660oib.85.2020.02.16.21.29.27; Sun, 16 Feb 2020 21:29:40 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726029AbgBQF3M (ORCPT + 99 others); Mon, 17 Feb 2020 00:29:12 -0500 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:57349 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725855AbgBQF3M (ORCPT ); Mon, 17 Feb 2020 00:29:12 -0500 X-Originating-IP: 79.86.19.127 Received: from debian.numericable.fr (127.19.86.79.rev.sfr.net [79.86.19.127]) (Authenticated sender: alex@ghiti.fr) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id CEF6D20002; Mon, 17 Feb 2020 05:28:48 +0000 (UTC) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt Cc: Anup Patel , Jan Kiszka , stable@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Ghiti Subject: [PATCH] riscv: Fix range looking for kernel image memblock Date: Mon, 17 Feb 2020 00:28:47 -0500 Message-Id: <20200217052847.3174-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When looking for the memblock where the kernel lives, we should check that the memory range associated to the memblock entirely comprises the kernel image and not only intersects with it. Signed-off-by: Alexandre Ghiti --- arch/riscv/mm/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 965a8cf4829c..fab855963c73 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -131,7 +131,7 @@ void __init setup_bootmem(void) for_each_memblock(memory, reg) { phys_addr_t end = reg->base + reg->size; - if (reg->base <= vmlinux_end && vmlinux_end <= end) { + if (reg->base <= vmlinux_start && vmlinux_end <= end) { mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET); /* -- 2.20.1