Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Suresh Jayaraman <sjayaraman-l3A5Bk7waGM@public.gmane.org>
Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] cifs: use memcpy for magic string in cifs signature generation BSRSPYL
Date: Wed, 24 Aug 2011 06:48:55 -0400	[thread overview]
Message-ID: <20110824064855.14daa82c@corrin.poochiereds.net> (raw)
In-Reply-To: <4E549A73.9020801-l3A5Bk7waGM@public.gmane.org>

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>

      parent reply	other threads:[~2011-08-24 10:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=20110824064855.14daa82c@corrin.poochiereds.net \
    --to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sjayaraman-l3A5Bk7waGM@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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