From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Alexander Shiyan <eagle.alexander923@gmail.com>
Subject: [PATCH 1/3] ARM64: mmu: Fix alloc_pte() address calculation
Date: Fri, 1 Dec 2023 16:10:42 +0100 [thread overview]
Message-ID: <20231201151044.1648393-1-s.hauer@pengutronix.de> (raw)
get_ttb() returns an uint64_t * which means that with
get_ttb() + idx * GRANULE_SIZE
the distance between two PTEs is wrongly calculated as 0x8000 bytes
instead of 0x1000 bytes. With this we leave the space allocated for PTEs
quite fast and the available space check also doesn't work.
Fix this by explicitly casting to void *.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/cpu/mmu_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/cpu/mmu_64.c b/arch/arm/cpu/mmu_64.c
index 716e717c72..d62527809e 100644
--- a/arch/arm/cpu/mmu_64.c
+++ b/arch/arm/cpu/mmu_64.c
@@ -45,7 +45,7 @@ static uint64_t *alloc_pte(void)
if (idx * GRANULE_SIZE >= ARM_EARLY_PAGETABLE_SIZE)
return NULL;
- return get_ttb() + idx * GRANULE_SIZE;
+ return (void *)get_ttb() + idx * GRANULE_SIZE;
}
#else
static uint64_t *alloc_pte(void)
--
2.39.2
next reply other threads:[~2023-12-01 15:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 15:10 Sascha Hauer [this message]
2023-12-01 15:10 ` [PATCH 2/3] ARM64: mmu: panic when out of PTEs Sascha Hauer
2023-12-01 15:10 ` [PATCH 3/3] ARM: Rockchip: dmc: print memory sizes in hex Sascha Hauer
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=20231201151044.1648393-1-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=eagle.alexander923@gmail.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