From: SeongJae Park <sj@kernel.org>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/cma: Replace snprintf with strscpy in cma_new_area
Date: Mon, 26 Jan 2026 16:47:22 -0800 [thread overview]
Message-ID: <20260127004723.74422-1-sj@kernel.org> (raw)
In-Reply-To: <20260126174516.236968-1-thorsten.blum@linux.dev>
Hello Thorsten,
On Mon, 26 Jan 2026 18:45:15 +0100 Thorsten Blum <thorsten.blum@linux.dev> wrote:
> Replace snprintf("%s", ...) with the faster and more direct strscpy().
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> mm/cma.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/cma.c b/mm/cma.c
> index 813e6dc7b095..44b43de28c13 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -22,6 +22,7 @@
> #include <linux/mm.h>
> #include <linux/sizes.h>
> #include <linux/slab.h>
> +#include <linux/string.h>
> #include <linux/string_choices.h>
> #include <linux/log2.h>
> #include <linux/cma.h>
> @@ -233,7 +234,7 @@ static int __init cma_new_area(const char *name, phys_addr_t size,
> cma_area_count++;
>
> if (name)
> - snprintf(cma->name, CMA_MAX_NAME, "%s", name);
> + strscpy(cma->name, name);
Any reason to drop CMA_MAX_NAME protection? You can pass the size of
destination buffer as the third argument of strscpy().
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-01-27 0:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 17:45 [PATCH] mm/cma: Replace snprintf with strscpy in cma_new_area Thorsten Blum
2026-01-27 0:47 ` SeongJae Park [this message]
2026-01-27 0:54 ` Andrew Morton
2026-01-27 1:05 ` SeongJae Park
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=20260127004723.74422-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=thorsten.blum@linux.dev \
--cc=vbabka@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.