The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ivy Lopez <skunkolee@gmail.com>
To: akpm@linux-foundation.org, david@kernel.org
Cc: ljs@kernel.org, liam@infradead.org, vbabka@kernel.org,
	rppt@kernel.org, surenb@google.com, mhocko@suse.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Ivy Lopez <skunkolee@gmail.com>
Subject: [PATCH] mm/cma: fix stray newline in auto-generated CMA area name
Date: Mon, 10 Aug 2026 18:34:41 -0600	[thread overview]
Message-ID: <20260811003441.63725-1-skunkolee@gmail.com> (raw)

When no explicit name is provided, cma_new_area() falls back to
generating one via snprintf(), but the format string contains an
embedded newline: "cma%d\n". This name is used as-is for the area's
sysfs entry (cma_sysfs.c) and debugfs directory (cma_debug.c), so
every auto-named CMA area ends up with a newline embedded in its
sysfs/debugfs name.

Drop the stray newline and the extra space after the size argument.

Signed-off-by: Ivy Lopez <skunkolee@gmail.com>
---
 mm/cma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/cma.c b/mm/cma.c
index a13ce4999b39..092cbb8f27ec 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -240,7 +240,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;
-- 
2.55.0


             reply	other threads:[~2026-08-11  0:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11  0:34 Ivy Lopez [this message]
2026-08-11  7:16 ` [PATCH] mm/cma: fix stray newline in auto-generated CMA area name David Hildenbrand (Arm)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260811003441.63725-1-skunkolee@gmail.com \
    --to=skunkolee@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox