linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Sabrina Dubroca <sd@queasysnail.net>,
	Paul Moore <pmoore@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH RESEND] fs: namei: Use memcpy instead of strlcpy
Date: Wed, 21 Jan 2015 14:44:25 -0800	[thread overview]
Message-ID: <1421880265-26647-1-git-send-email-linux@roeck-us.net> (raw)

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.

Resending with correct cc:. Sorry for the noise.

 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


             reply	other threads:[~2015-01-21 22:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-21 22:44 Guenter Roeck [this message]
2015-01-22  0:44 ` [PATCH RESEND] fs: namei: Use memcpy instead of strlcpy Paul Moore
2015-01-22  1:59   ` Guenter Roeck

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=1421880265-26647-1-git-send-email-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmoore@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).