mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs: namei: Use memcpy instead of strlcpy
@ 2015-01-21 21:51 Guenter Roeck
  0 siblings, 0 replies; only message in thread
From: Guenter Roeck @ 2015-01-21 21:51 UTC (permalink / raw)
  To: Alexander Viro
  Cc: Sabrina Dubroca, Paul Moore, inux-fsdevel, linux-kernel, Guenter Roeck

If the string length is known, there is no need to use strlcpy.
Use memcpy instead.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Nitpick, but still a bit faster. Applies on top of -next.

 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namei.c b/fs/namei.c
index 323957f..2e09219 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -233,7 +233,7 @@ getname_kernel(const char * filename)
 		__putname(result);
 		return ERR_PTR(-ENAMETOOLONG);
 	}
-	strlcpy((char *)result->name, filename, len);
+	memcpy((char *)result->name, filename, len);
 	result->uptr = NULL;
 	result->aname = NULL;
 	result->refcnt = 1;
-- 
2.1.0


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

only message in thread, other threads:[~2015-01-21 21:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 21:51 [PATCH] fs: namei: Use memcpy instead of strlcpy Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®