diff mbox series

[2/2] sh: initialize max_mapnr

Message ID 20230214140729.1649961-3-rppt@kernel.org (mailing list archive)
State New, archived
Headers show
Series fixups for generic implementation of pfn_valid() | expand

Commit Message

Mike Rapoport Feb. 14, 2023, 2:07 p.m. UTC
From: "Mike Rapoport (IBM)" <rppt@kernel.org>

sh never initializes max_mapnr which is used by the generic
implementation of pfn_valid().

Initialize max_mapnr with set_max_mapnr() in sh::paging_init().

Reported-by: Guenter Roeck <linux@roeck-us.net>
Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
---
 arch/sh/mm/init.c | 1 +
 1 file changed, 1 insertion(+)

Comments

John Paul Adrian Glaubitz Feb. 14, 2023, 2:41 p.m. UTC | #1
On Tue, 2023-02-14 at 16:07 +0200, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
> 
> sh never initializes max_mapnr which is used by the generic
> implementation of pfn_valid().
> 
> Initialize max_mapnr with set_max_mapnr() in sh::paging_init().
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
>  arch/sh/mm/init.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
> index 506784702430..bf1b54055316 100644
> --- a/arch/sh/mm/init.c
> +++ b/arch/sh/mm/init.c
> @@ -301,6 +301,7 @@ void __init paging_init(void)
>  	 */
>  	max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
>  	min_low_pfn = __MEMORY_START >> PAGE_SHIFT;
> +	set_max_mapnr(max_low_pfn - min_low_pfn);
>  
>  	nodes_clear(node_online_map);
>  

Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
David Hildenbrand Feb. 16, 2023, 12:56 p.m. UTC | #2
On 14.02.23 15:07, Mike Rapoport wrote:
> From: "Mike Rapoport (IBM)" <rppt@kernel.org>
> 
> sh never initializes max_mapnr which is used by the generic
> implementation of pfn_valid().
> 
> Initialize max_mapnr with set_max_mapnr() in sh::paging_init().
> 
> Reported-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: e5080a967785 ("mm, arch: add generic implementation of pfn_valid() for FLATMEM")
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>
> ---
>   arch/sh/mm/init.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
> index 506784702430..bf1b54055316 100644
> --- a/arch/sh/mm/init.c
> +++ b/arch/sh/mm/init.c
> @@ -301,6 +301,7 @@ void __init paging_init(void)
>   	 */
>   	max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
>   	min_low_pfn = __MEMORY_START >> PAGE_SHIFT;
> +	set_max_mapnr(max_low_pfn - min_low_pfn);
>   
>   	nodes_clear(node_online_map);
>   

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 506784702430..bf1b54055316 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -301,6 +301,7 @@  void __init paging_init(void)
 	 */
 	max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
 	min_low_pfn = __MEMORY_START >> PAGE_SHIFT;
+	set_max_mapnr(max_low_pfn - min_low_pfn);
 
 	nodes_clear(node_online_map);