All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] fs: namei: Use memcpy instead of strlcpy
@ 2015-01-21 22:44 Guenter Roeck
  2015-01-22  0:44 ` Paul Moore
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2015-01-21 22:44 UTC (permalink / raw)
  To: Alexander Viro
  Cc: Sabrina Dubroca, Paul Moore, linux-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.

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] fs: namei: Use memcpy instead of strlcpy
  2015-01-21 22:44 [PATCH RESEND] fs: namei: Use memcpy instead of strlcpy Guenter Roeck
@ 2015-01-22  0:44 ` Paul Moore
  2015-01-22  1:59   ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Moore @ 2015-01-22  0:44 UTC (permalink / raw)
  To: Guenter Roeck, Alexander Viro
  Cc: Sabrina Dubroca, Paul Moore, linux-fsdevel, linux-kernel

Good point.  Do you mind if I merge your patch into my existing patch 
instead of including it separately?

--
paul moore
www.paul-moore.com



On January 21, 2015 5:45:29 PM Guenter Roeck <linux@roeck-us.net> wrote:

> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] fs: namei: Use memcpy instead of strlcpy
  2015-01-22  0:44 ` Paul Moore
@ 2015-01-22  1:59   ` Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2015-01-22  1:59 UTC (permalink / raw)
  To: Paul Moore, Alexander Viro
  Cc: Sabrina Dubroca, Paul Moore, linux-fsdevel, linux-kernel

On 01/21/2015 04:44 PM, Paul Moore wrote:
> Good point.  Do you mind if I merge your patch into my existing patch instead of including it separately?
>
Sure, no problem. Go ahead.

Guenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-22  1:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 22:44 [PATCH RESEND] fs: namei: Use memcpy instead of strlcpy Guenter Roeck
2015-01-22  0:44 ` Paul Moore
2015-01-22  1:59   ` Guenter Roeck

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.