All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cifs: use memcpy for magic string in cifs signature generation BSRSPYL
@ 2011-08-20  1:19 Jeff Layton
       [not found] ` <1313803157-31952-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2011-08-20  1:19 UTC (permalink / raw)
  To: smfrench-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA

...it's more efficient since we know the length.

Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/cifs/cifsencrypt.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index e76bfeb..f11dfb6 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -92,7 +92,7 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server,
 		return rc;
 
 	if (!server->session_estab) {
-		strncpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
+		memcpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
 		return rc;
 	}
 
@@ -189,7 +189,7 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server,
 		return rc;
 
 	if (!server->session_estab) {
-		strncpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
+		memcpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
 		return rc;
 	}
 
-- 
1.7.6

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

* Re: [PATCH] cifs: use memcpy for magic string in cifs signature generation BSRSPYL
       [not found] ` <1313803157-31952-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2011-08-24  6:30   ` Suresh Jayaraman
       [not found]     ` <4E549A73.9020801-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Suresh Jayaraman @ 2011-08-24  6:30 UTC (permalink / raw)
  To: Jeff Layton
  Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA

On 08/20/2011 06:49 AM, Jeff Layton wrote:
> ...it's more efficient since we know the length.
> 
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  fs/cifs/cifsencrypt.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
> index e76bfeb..f11dfb6 100644
> --- a/fs/cifs/cifsencrypt.c
> +++ b/fs/cifs/cifsencrypt.c
> @@ -92,7 +92,7 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server,
>  		return rc;
>  
>  	if (!server->session_estab) {
> -		strncpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
> +		memcpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
>  		return rc;
>  	}
>  
> @@ -189,7 +189,7 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server,
>  		return rc;
>  
>  	if (!server->session_estab) {
> -		strncpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
> +		memcpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
>  		return rc;
>  	}
>  


Looks good to me.

Reviewed-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>

Any reason why some of the strncpy/strncmp cases were only picked up
among the rest? May be depending on how hot the code path is?

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

* Re: [PATCH] cifs: use memcpy for magic string in cifs signature generation BSRSPYL
       [not found]     ` <4E549A73.9020801-l3A5Bk7waGM@public.gmane.org>
@ 2011-08-24 10:48       ` Jeff Layton
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Layton @ 2011-08-24 10:48 UTC (permalink / raw)
  To: Suresh Jayaraman
  Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA

On Wed, 24 Aug 2011 12:00:11 +0530
Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org> wrote:

> On 08/20/2011 06:49 AM, Jeff Layton wrote:
> > ...it's more efficient since we know the length.
> > 
> > Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> > ---
> >  fs/cifs/cifsencrypt.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
> > index e76bfeb..f11dfb6 100644
> > --- a/fs/cifs/cifsencrypt.c
> > +++ b/fs/cifs/cifsencrypt.c
> > @@ -92,7 +92,7 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server,
> >  		return rc;
> >  
> >  	if (!server->session_estab) {
> > -		strncpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
> > +		memcpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
> >  		return rc;
> >  	}
> >  
> > @@ -189,7 +189,7 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server,
> >  		return rc;
> >  
> >  	if (!server->session_estab) {
> > -		strncpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
> > +		memcpy(cifs_pdu->Signature.SecuritySignature, "BSRSPYL", 8);
> >  		return rc;
> >  	}
> >  
> 
> 
> Looks good to me.
> 
> Reviewed-by: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
> 
> Any reason why some of the strncpy/strncmp cases were only picked up
> among the rest? May be depending on how hot the code path is?
> 

Simply because that's where I noticed them. If you see other places
that could benefit, then it's probably reasonable to patch them too.

-- 
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

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

end of thread, other threads:[~2011-08-24 10:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-20  1:19 [PATCH] cifs: use memcpy for magic string in cifs signature generation BSRSPYL Jeff Layton
     [not found] ` <1313803157-31952-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-08-24  6:30   ` Suresh Jayaraman
     [not found]     ` <4E549A73.9020801-l3A5Bk7waGM@public.gmane.org>
2011-08-24 10:48       ` Jeff Layton

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.