linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] Fix assgining cma_area_count
@ 2022-01-09  7:39 Ercan Ersoy
  2022-01-12  9:22 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Ercan Ersoy @ 2022-01-09  7:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, akpm


I have patched "Contiguous Memory Allocator" of Linux kernel.

This fix of patch is for cma_init_reserved_mem function in
mm/cma.c source file as creating area without specific name.

Without fix may be a problem a lot of cma as next cma2147483647 naming.
Without fix may be a problem huge memory systems.

I think after "cma2147483647" naming is "cma-2147483648".

Thanks for interesting,
Ercan

--- START PATCH ---
 From 5d3d01a3a0f7339617d1df945c0bd0ec1ab91ae3 Mon Sep 17 00:00:00 2001
 From: Ercan Ersoy <ercanersoy@ercanersoy.net>
Date: Sun, 9 Jan 2022 10:01:14 +0300
Subject: [PATCH 2/2] Fix assgining cma_area_count

Fix assigning to cma->name in cma_init_reserved_mem function
in mm/cma.c source file.

Signed-off-by: Ercan Ersoy <ercanersoy@ercanersoy.net>
---
  mm/cma.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/cma.c b/mm/cma.c
index bc9ca8f3c487..03f01d1f1b57 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -199,7 +199,7 @@ int __init cma_init_reserved_mem(phys_addr_t base, 
phys_addr_t size,
  	if (name)
  		snprintf(cma->name, CMA_MAX_NAME, name);
  	else
-		snprintf(cma->name, CMA_MAX_NAME,  "cma%d\n", cma_area_count);
+		snprintf(cma->name, CMA_MAX_NAME,  "cma%u\n", cma_area_count);

  	cma->base_pfn = PFN_DOWN(base);
  	cma->count = size >> PAGE_SHIFT;
-- 
2.30.2


--- END PATCH ---

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] Fix assgining cma_area_count
  2022-01-09  7:39 [PATCH 2/2] Fix assgining cma_area_count Ercan Ersoy
@ 2022-01-12  9:22 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2022-01-12  9:22 UTC (permalink / raw)
  To: Ercan Ersoy, linux-kernel; +Cc: linux-mm, akpm

On 09.01.22 08:39, Ercan Ersoy wrote:
> 
> I have patched "Contiguous Memory Allocator" of Linux kernel.
> 
> This fix of patch is for cma_init_reserved_mem function in
> mm/cma.c source file as creating area without specific name.
> 
> Without fix may be a problem a lot of cma as next cma2147483647 naming.
> Without fix may be a problem huge memory systems.
> 
> I think after "cma2147483647" naming is "cma-2147483648".
> 
> Thanks for interesting,
> Ercan
> 
> --- START PATCH ---
>  From 5d3d01a3a0f7339617d1df945c0bd0ec1ab91ae3 Mon Sep 17 00:00:00 2001
>  From: Ercan Ersoy <ercanersoy@ercanersoy.net>
> Date: Sun, 9 Jan 2022 10:01:14 +0300
> Subject: [PATCH 2/2] Fix assgining cma_area_count
> 
> Fix assigning to cma->name in cma_init_reserved_mem function
> in mm/cma.c source file.
> 

Honestly, how on earth are we supposed to have that many CMA areas?

It's limited by MAX_CMA_AREAS, which is usually ... 7 or 19.

Calling this a fix is a bit though. This is a cleanup we might not care
too much about.

> Signed-off-by: Ercan Ersoy <ercanersoy@ercanersoy.net>
> ---
>   mm/cma.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/cma.c b/mm/cma.c
> index bc9ca8f3c487..03f01d1f1b57 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -199,7 +199,7 @@ int __init cma_init_reserved_mem(phys_addr_t base, 
> phys_addr_t size,
>   	if (name)
>   		snprintf(cma->name, CMA_MAX_NAME, name);
>   	else
> -		snprintf(cma->name, CMA_MAX_NAME,  "cma%d\n", cma_area_count);
> +		snprintf(cma->name, CMA_MAX_NAME,  "cma%u\n", cma_area_count);
> 
>   	cma->base_pfn = PFN_DOWN(base);
>   	cma->count = size >> PAGE_SHIFT;


-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-12  9:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-09  7:39 [PATCH 2/2] Fix assgining cma_area_count Ercan Ersoy
2022-01-12  9:22 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).