Skip to contentSkip to conversation

mm/cma: remove stray newline from auto-generated CMA area name

PATCH Applied Hongfu Li 5 participants 5 messages Aug 10 – Aug 11

Subsystems (2)
lore
Share & tools
lore

Hongfu Li

author
#0 lore raw

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
index a7929c758df1..a10ea37a261d 100644
@@ -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
maintainer Acked-by on v1 1/1
#1 lore raw
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.

---
 mm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/cma.c +0 -0
index a7929c758df1..a10ea37a261d 100644

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
reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Hongfu Li
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.

LGTM so:

Quoted 9 lines
---
 mm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/cma.c +0 -0
index a7929c758df1..a10ea37a261d 100644

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 -1
 	cma->available_count = cma->count = size >> PAGE_SHIFT;
 	cma->order_per_bit = order_per_bit;
--

2.54.0

--
Cheers, Lorenzo

Reviewed-by on v1 1/1
#3 lore raw
In reply to Hongfu Li
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.

Quoted 9 lines
---
 mm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/cma.c +0 -0
index a7929c758df1..a10ea37a261d 100644

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

[...]

Reviewed-by on v1 1/1
#4 lore raw
In reply to Hongfu Li
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.

Quoted 20 lines
---
 mm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/cma.c +1 -1
index a7929c758df1..a10ea37a261d 100644
@@ -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