Skip to content

Commit 5f763b3

Browse files
AlexGhitipalmer-dabbelt
authored andcommitted
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: f7ae023 ("riscv: Move KASAN mapping next to the kernel mapping") Signed-off-by: Alexandre Ghiti <[email protected]> Cc: [email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent a3d3280 commit 5f763b3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/riscv/mm/physaddr.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88

99
phys_addr_t __virt_to_phys(unsigned long x)
1010
{
11-
phys_addr_t y = x - PAGE_OFFSET;
12-
1311
/*
1412
* Boundary checking aginst the kernel linear mapping space.
1513
*/
16-
WARN(y >= KERN_VIRT_SIZE,
14+
WARN(!is_linear_mapping(x) && !is_kernel_mapping(x),
1715
"virt_to_phys used for non-linear address: %pK (%pS)\n",
1816
(void *)x, (void *)x);
1917

0 commit comments

Comments
 (0)