mm/cma: remove stray newline from auto-generated CMA area name
Subsystems (2)
PATCH 1/1 mm/cma: remove stray newline from auto-generated CMA area name
From: Hongfu Li <[email protected]>
When no name is supplied, cma_new_area() generates names with format "cma%d\n", introducing an unintended newline character ('\n') in the CMA name.
Most CMA regions are created with explicit names, so this path is seldom hit. The newline only creates cosmetic noise in debug logs, traces and debugfs with no functional impact.
--- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/cma.c +1 -1
@@ -242,7 +242,7 @@ static int __init cma_new_area(const char *name, phys_addr_t size,if (name)strscpy (cma->name, name);else -snprintf (cma->name,CMA_MAX_NAME ,"cma%d\n" , cma_area_count); +snprintf (cma->name,CMA_MAX_NAME ,"cma%d" , cma_area_count); cma->available_count = cma->count = size >>PAGE_SHIFT ; cma->order_per_bit = order_per_bit;
Signature · 1 line
2.54.0
Quoted 20 lines · Hongfu Li
From: Hongfu Li <[email protected]>
When no name is supplied,
cma_new_area()generates names with format "cma%d\n", introducing an unintended newline character ('\n') in the CMA name.Most CMA regions are created with explicit names, so this path is seldom hit. The newline only creates cosmetic noise in debug logs, traces and debugfs with no functional impact.
Signed-off-by Hongfu Li <[email protected]>--- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/cma.c +0
-0
mm/cma.c static int __init cma_new_area(const char *name, phys_addr_t size, · line 248
Quoted 8 lines
mm/cma.c +1
-1@@ -242,7 +242,7 @@ static int __init cma_new_area(const char *name, phys_addr_t size,if (name)strscpy (cma->name, name);else -snprintf (cma->name,CMA_MAX_NAME ,"cma%d\n" , cma_area_count); +snprintf (cma->name,CMA_MAX_NAME ,"cma%d" , cma_area_count); cma->available_count = cma->count = size >>PAGE_SHIFT ; cma->order_per_bit = order_per_bit;
Signature · 3 lines
Cheers, David
Quoted 11 lines · Hongfu Li
From: Hongfu Li <[email protected]>
When no name is supplied,
cma_new_area()generates names with format "cma%d\n", introducing an unintended newline character ('\n') in the CMA name.Most CMA regions are created with explicit names, so this path is seldom hit. The newline only creates cosmetic noise in debug logs, traces and debugfs with no functional impact.
Signed-off-by Hongfu Li <[email protected]>
LGTM so:
Quoted 9 lines
--- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/cma.c +0
-0
mm/cma.c static int __init cma_new_area(const char *name, phys_addr_t size, · line 245
Quoted 5 lines
mm/cma.c +1
-1@@ -242,7 +242,7 @@ static int __init cma_new_area(const char *name, phys_addr_t size,if (name)strscpy (cma->name, name);else -snprintf (cma->name,CMA_MAX_NAME ,"cma%d\n" , cma_area_count); +snprintf (cma->name,CMA_MAX_NAME ,"cma%d" , cma_area_count);
Ha :) I think somebody typo'd this on muscle memory gained from printk :)
Quoted 6 lines
mm/cma.c +0
-1cma->available_count = cma->count = size >>PAGE_SHIFT ; cma->order_per_bit = order_per_bit; --2.54.0
--
Cheers, Lorenzo
Quoted 5 lines · On Mon, 10 Aug 2026 17:32:15 +0800 Hongfu Li <[email protected]> wrote:
From: Hongfu Li <[email protected]>
When no name is supplied,
cma_new_area()generates names with format "cma%d\n", introducing an unintended newline character ('\n') in the CMA name.
Nice catch!
Quoted 6 lines
Most CMA regions are created with explicit names, so this path is seldom hit. The newline only creates cosmetic noise in debug logs, traces and debugfs with no functional impact.
Signed-off-by Hongfu Li <[email protected]>
Quoted 9 lines
--- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/cma.c +0
-0
mm/cma.c static int __init cma_new_area(const char *name, phys_addr_t size, · line 245
Quoted 5 lines
mm/cma.c +1
-1@@ -242,7 +242,7 @@ static int __init cma_new_area(const char *name, phys_addr_t size,if (name)strscpy (cma->name, name);else -snprintf (cma->name,CMA_MAX_NAME ,"cma%d\n" , cma_area_count); +snprintf (cma->name,CMA_MAX_NAME ,"cma%d" , cma_area_count);
It also removes one unnecessary space! Nice!
Thanks,
SJ
[...]
Quoted 11 lines · Hongfu Li
From: Hongfu Li <[email protected]>
When no name is supplied,
cma_new_area()generates names with format "cma%d\n", introducing an unintended newline character ('\n') in the CMA name.Most CMA regions are created with explicit names, so this path is seldom hit. The newline only creates cosmetic noise in debug logs, traces and debugfs with no functional impact.
Signed-off-by Hongfu Li <[email protected]>
Quoted 20 lines
--- mm/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/cma.c +1
-1@@ -242,7 +242,7 @@ static int __init cma_new_area(const char *name, phys_addr_t size,if (name)strscpy (cma->name, name);else -snprintf (cma->name,CMA_MAX_NAME ,"cma%d\n" , cma_area_count); +snprintf (cma->name,CMA_MAX_NAME ,"cma%d" , cma_area_count); cma->available_count = cma->count = size >>PAGE_SHIFT ; cma->order_per_bit = order_per_bit;Signature · 1 line
2.54.0