diff mbox

CIFS: convert to use le32_add_cpu()

Message ID CAPgLHd9CMLtxDq=+96ksygONivXRrmDHqE7+=8SbjOpTNGF=DA@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Yongjun Aug. 26, 2013, 6:34 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

Convert cpu_to_le32(le32_to_cpu(E1) + E2) to use le32_add_cpu().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 fs/cifs/smb2pdu.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)


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

Comments

Shirish Pargaonkar Aug. 28, 2013, 1:11 p.m. UTC | #1
Looks correct.

Acked-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>

On Mon, Aug 26, 2013 at 1:34 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Convert cpu_to_le32(le32_to_cpu(E1) + E2) to use le32_add_cpu().
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>  fs/cifs/smb2pdu.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index abc9c28..4ce66bc 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -939,9 +939,7 @@ add_lease_context(struct kvec *iov, unsigned int *num_iovec, __u8 *oplock)
>                 req->CreateContextsOffset = cpu_to_le32(
>                                 sizeof(struct smb2_create_req) - 4 +
>                                 iov[num - 1].iov_len);
> -       req->CreateContextsLength = cpu_to_le32(
> -                               le32_to_cpu(req->CreateContextsLength) +
> -                               sizeof(struct create_lease));
> +       le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_lease));
>         inc_rfc1001_len(&req->hdr, sizeof(struct create_lease));
>         *num_iovec = num + 1;
>         return 0;
> @@ -967,9 +965,7 @@ add_durable_context(struct kvec *iov, unsigned int *num_iovec,
>                 req->CreateContextsOffset =
>                         cpu_to_le32(sizeof(struct smb2_create_req) - 4 +
>                                                                 iov[1].iov_len);
> -       req->CreateContextsLength =
> -                       cpu_to_le32(le32_to_cpu(req->CreateContextsLength) +
> -                                               sizeof(struct create_durable));
> +       le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_durable));
>         inc_rfc1001_len(&req->hdr, sizeof(struct create_durable));
>         *num_iovec = num + 1;
>         return 0;
>
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index abc9c28..4ce66bc 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -939,9 +939,7 @@  add_lease_context(struct kvec *iov, unsigned int *num_iovec, __u8 *oplock)
 		req->CreateContextsOffset = cpu_to_le32(
 				sizeof(struct smb2_create_req) - 4 +
 				iov[num - 1].iov_len);
-	req->CreateContextsLength = cpu_to_le32(
-				le32_to_cpu(req->CreateContextsLength) +
-				sizeof(struct create_lease));
+	le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_lease));
 	inc_rfc1001_len(&req->hdr, sizeof(struct create_lease));
 	*num_iovec = num + 1;
 	return 0;
@@ -967,9 +965,7 @@  add_durable_context(struct kvec *iov, unsigned int *num_iovec,
 		req->CreateContextsOffset =
 			cpu_to_le32(sizeof(struct smb2_create_req) - 4 +
 								iov[1].iov_len);
-	req->CreateContextsLength =
-			cpu_to_le32(le32_to_cpu(req->CreateContextsLength) +
-						sizeof(struct create_durable));
+	le32_add_cpu(&req->CreateContextsLength, sizeof(struct create_durable));
 	inc_rfc1001_len(&req->hdr, sizeof(struct create_durable));
 	*num_iovec = num + 1;
 	return 0;