mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Muchun Song <smuchun@gmail.com>
To: catalin.marinas@arm.com, will.deacon@arm.com
Cc: akpm@linux-foundation.org, rppt@linux.vnet.ibm.com,
	ard.biesheuvel@linaro.org, f.fainelli@gmail.com,
	logang@deltatee.com, robin.murphy@arm.com, ghackmann@android.com,
	hannes@cmpxchg.org, stefan@agner.ch, david@redhat.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] arm64: mm: fix max_mapnr is assigned the wrong value
Date: Sat, 30 Mar 2019 21:13:46 +0800	[thread overview]
Message-ID: <20190330131346.40289-1-smuchun@gmail.com> (raw)

When we not use flat memory, the mem_map will be NULL and
pfn_to_page(max_pfn) is a pointer which is located in kernel space. So
max_mapnr is assigned a very large number(e.g., 0xffffxxxx_xxxxxxxx) - fix
it.

Signed-off-by: Muchun Song <smuchun@gmail.com>
---
 arch/arm64/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index bc02818fa48b..e86c21a44c88 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -535,7 +535,7 @@ void __init mem_init(void)
 	else
 		swiotlb_force = SWIOTLB_NO_FORCE;
 
-	set_max_mapnr(pfn_to_page(max_pfn) - mem_map);
+	set_max_mapnr(max_pfn - PHYS_PFN_OFFSET);
 
 #ifndef CONFIG_SPARSEMEM_VMEMMAP
 	free_unused_memmap();
-- 
2.17.1


             reply	other threads:[~2019-03-30 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-30 13:13 Muchun Song [this message]
2019-04-01 10:44 ` Catalin Marinas
2019-04-01 14:21   ` Muchun Song
2019-04-01 14:32     ` Catalin Marinas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190330131346.40289-1-smuchun@gmail.com \
    --to=smuchun@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=david@redhat.com \
    --cc=f.fainelli@gmail.com \
    --cc=ghackmann@android.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=robin.murphy@arm.com \
    --cc=rppt@linux.vnet.ibm.com \
    --cc=stefan@agner.ch \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®