Skip to content

Commit d2f08d8

Browse files
committed
ARCv3: fix valid pfns counting
Fix min_low_pfn counting. For ARCv3 explicit use of __pa() modifies address which cause to bad min_low_pfn value. For configurations where CONFIG_LINUX_RAM_BASE is not equal to PAGE_OFFSET we should consider CONFIG_LINUX_RAM_BASE as physical address. This patch fixes min_low_pfn value counting. This variable is used to check virt address by virt_addr_valid() macro to determine that the address resides in the kernel "direct mapping area". Without this patch some unexpected kernel crashes can be observed, for example in __check_object_size() function because of incorrect check of virt_addr_valid() macro, virt_to_page() macro can be called with virt address from VMALLOC area and return bad pointer to page struct object. This change is actual for ARCv3 not affect behavior of ARCv2. Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
1 parent 96c99c6 commit d2f08d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arc/mm/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void __init setup_arch_memory(void)
102102
setup_initial_init_mm(_text, _etext, _edata, _end);
103103

104104
/* first page of system - kernel .vector starts here */
105-
min_low_pfn = virt_to_pfn(CONFIG_LINUX_RAM_BASE);
105+
min_low_pfn = PFN_DOWN(low_mem_start);
106106

107107
/* Last usable page of low mem */
108108
max_low_pfn = max_pfn = PFN_DOWN(low_mem_start + low_mem_sz);

0 commit comments

Comments
 (0)