archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/dmapool: switch from strlcpy to strscpy
@ 2021-02-22  2:47 Zhiyuan Dai
  0 siblings, 0 replies; only message in thread
From: Zhiyuan Dai @ 2021-02-22  2:47 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Zhiyuan Dai

strlcpy is marked as deprecated in Documentation/process/deprecated.rst,
and there is no functional difference when the caller expects truncation
(when not checking the return value). strscpy is relatively better as it
also avoids scanning the whole source string.

Signed-off-by: Zhiyuan Dai <>
 mm/dmapool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/dmapool.c b/mm/dmapool.c
index a97c972..38cf2a7 100644
--- a/mm/dmapool.c
+++ b/mm/dmapool.c
@@ -156,7 +156,7 @@ struct dma_pool *dma_pool_create(const char *name, struct device *dev,
 	if (!retval)
 		return retval;
-	strlcpy(retval->name, name, sizeof(retval->name));
+	strscpy(retval->name, name, sizeof(retval->name));
 	retval->dev = dev;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-22  2:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22  2:47 [PATCH] mm/dmapool: switch from strlcpy to strscpy Zhiyuan Dai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).