From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D5CA4C6D for ; Tue, 27 Jan 2026 00:47:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769474851; cv=none; b=CcnK6Xyr/jyIzsL93nIECtcN78wW+T64imnjOVyy9qLOrhFpo6OqPH1aew5CExtiGJV5GZY5B73e8V4Gz9x1MBJ9+JuQNpGqIgsoeWvmOitxZjL9s2vnNfzuMLt+qX5qW59EURcsVwpyn3OXXT/im3TzFfzpNC7vvZnzEVQmXOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769474851; c=relaxed/simple; bh=o4cpQ2rr6KeMaWgY+0sspntwm5GM5tEpAhU7E40caqY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ps/Q0bZFXHNiHmyZYA1d9hGH8IHIqaLrxilTRTko0gXa0+lBmKB3Ye2AwBOh4FyvMb0tY3YL7PS0YtT7f9MKxaNiki7JBIfOtrf+O49YyyIm4vbw6Kn04M1N2cQW02FOHUIrSRSasIfoH2MCb8pWtweckYU3HnZng4bGk1v8GM0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HvpsxbeY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HvpsxbeY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA882C116C6; Tue, 27 Jan 2026 00:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769474851; bh=o4cpQ2rr6KeMaWgY+0sspntwm5GM5tEpAhU7E40caqY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HvpsxbeYxiMgxSUL11CwhU52txRzTU2qIG2m3opA1l1AT6SI+JhguSAdsFzbWhYEf dafvZQ+KG8HXw35DCitqpQOlI1JMdCsNBlDzN6BvbgPveKjRVS8YEXQhJO2W5YaiAh qZyaki7kf5wOaYxPRRpSbh47j+yPU4xp5czI/HzKWsdeHrW/2Ge8c+9KcDvMRELAku 8Zmg3C/Qt8goOgMpQhaVfqetZSzm30Y5YNTaN+aFmtkXQM9iMWW972e9HuPBlJ/+EZ lmgixTDm0Ba0tooxa2SQa12xZZBpAafteMFa+Ix0U02jnXXdTspuRi3gPp27KeL+4L nEaw9Bzp8li5w== From: SeongJae Park To: Thorsten Blum Cc: SeongJae Park , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , 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 Message-ID: <20260127004723.74422-1-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260126174516.236968-1-thorsten.blum@linux.dev> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello Thorsten, On Mon, 26 Jan 2026 18:45:15 +0100 Thorsten Blum wrote: > Replace snprintf("%s", ...) with the faster and more direct strscpy(). > > Signed-off-by: Thorsten Blum > --- > 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 > #include > #include > +#include > #include > #include > #include > @@ -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 [...]