Re: [PATCH] cifs: use memcpy for magic string in cifs signature generation BSRSPYL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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@xxxxxxx>

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?

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux