Skip to content
Snippets Groups Projects
Unverified Commit 5f763b3b authored by Alexandre Ghiti's avatar Alexandre Ghiti Committed by Palmer Dabbelt
Browse files

riscv: Fix DEBUG_VIRTUAL false warnings


KERN_VIRT_SIZE used to encompass the kernel mapping before it was
redefined when moving the kasan mapping next to the kernel mapping to only
match the maximum amount of physical memory.

Then, kernel mapping addresses that go through __virt_to_phys are now
declared as wrong which is not true, one can use __virt_to_phys on such
addresses.

Fix this by redefining the condition that matches wrong addresses.

Fixes: f7ae0233 ("riscv: Move KASAN mapping next to the kernel mapping")
Signed-off-by: default avatarAlexandre Ghiti <alexandre.ghiti@canonical.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
parent a3d32803
No related merge requests found
...@@ -8,12 +8,10 @@ ...@@ -8,12 +8,10 @@
phys_addr_t __virt_to_phys(unsigned long x) phys_addr_t __virt_to_phys(unsigned long x)
{ {
phys_addr_t y = x - PAGE_OFFSET;
/* /*
* Boundary checking aginst the kernel linear mapping space. * Boundary checking aginst the kernel linear mapping space.
*/ */
WARN(y >= KERN_VIRT_SIZE, WARN(!is_linear_mapping(x) && !is_kernel_mapping(x),
"virt_to_phys used for non-linear address: %pK (%pS)\n", "virt_to_phys used for non-linear address: %pK (%pS)\n",
(void *)x, (void *)x); (void *)x, (void *)x);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment