linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] cifs: convert to use be32_add_cpu()
@ 2020-07-25  8:56 Qinglang Miao
  2020-07-27  1:29 ` Steve French
  0 siblings, 1 reply; 2+ messages in thread
From: Qinglang Miao @ 2020-07-25  8:56 UTC (permalink / raw)
  To: Steve French, Greg Kroah-Hartman; +Cc: linux-cifs, linux-kernel

Convert cpu_to_be32(be32_to_cpu(E1) + E2) to use be32_add_cpu().

Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
 fs/cifs/connect.c | 3 +--
 fs/cifs/sess.c    | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 889fee586..552975420 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -5114,8 +5114,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
 	bcc_ptr += strlen("?????");
 	bcc_ptr += 1;
 	count = bcc_ptr - &pSMB->Password[0];
-	pSMB->hdr.smb_buf_length = cpu_to_be32(be32_to_cpu(
-					pSMB->hdr.smb_buf_length) + count);
+	be32_add_cpu(&pSMB->hdr.smb_buf_length, count);
 	pSMB->ByteCount = cpu_to_le16(count);
 
 	rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length,
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 6708ab0aa..69cd58566 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -938,8 +938,7 @@ sess_sendreceive(struct sess_data *sess_data)
 	struct kvec rsp_iov = { NULL, 0 };
 
 	count = sess_data->iov[1].iov_len + sess_data->iov[2].iov_len;
-	smb_buf->smb_buf_length =
-		cpu_to_be32(be32_to_cpu(smb_buf->smb_buf_length) + count);
+	be32_add_cpu(&smb_buf->smb_buf_length, count);
 	put_bcc(count, smb_buf);
 
 	rc = SendReceive2(sess_data->xid, sess_data->ses,
-- 
2.25.1


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

* Re: [PATCH -next] cifs: convert to use be32_add_cpu()
  2020-07-25  8:56 [PATCH -next] cifs: convert to use be32_add_cpu() Qinglang Miao
@ 2020-07-27  1:29 ` Steve French
  0 siblings, 0 replies; 2+ messages in thread
From: Steve French @ 2020-07-27  1:29 UTC (permalink / raw)
  To: Qinglang Miao; +Cc: Steve French, Greg Kroah-Hartman, CIFS, LKML

merged into cifs-2.6.git for-next

and for-next also updated with 5.8-rc7

On Sat, Jul 25, 2020 at 3:53 AM Qinglang Miao <miaoqinglang@huawei.com> wrote:
>
> Convert cpu_to_be32(be32_to_cpu(E1) + E2) to use be32_add_cpu().
>
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
>  fs/cifs/connect.c | 3 +--
>  fs/cifs/sess.c    | 3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 889fee586..552975420 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -5114,8 +5114,7 @@ CIFSTCon(const unsigned int xid, struct cifs_ses *ses,
>         bcc_ptr += strlen("?????");
>         bcc_ptr += 1;
>         count = bcc_ptr - &pSMB->Password[0];
> -       pSMB->hdr.smb_buf_length = cpu_to_be32(be32_to_cpu(
> -                                       pSMB->hdr.smb_buf_length) + count);
> +       be32_add_cpu(&pSMB->hdr.smb_buf_length, count);
>         pSMB->ByteCount = cpu_to_le16(count);
>
>         rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, &length,
> diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
> index 6708ab0aa..69cd58566 100644
> --- a/fs/cifs/sess.c
> +++ b/fs/cifs/sess.c
> @@ -938,8 +938,7 @@ sess_sendreceive(struct sess_data *sess_data)
>         struct kvec rsp_iov = { NULL, 0 };
>
>         count = sess_data->iov[1].iov_len + sess_data->iov[2].iov_len;
> -       smb_buf->smb_buf_length =
> -               cpu_to_be32(be32_to_cpu(smb_buf->smb_buf_length) + count);
> +       be32_add_cpu(&smb_buf->smb_buf_length, count);
>         put_bcc(count, smb_buf);
>
>         rc = SendReceive2(sess_data->xid, sess_data->ses,
> --
> 2.25.1
>


-- 
Thanks,

Steve

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

end of thread, other threads:[~2020-07-27  1:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-25  8:56 [PATCH -next] cifs: convert to use be32_add_cpu() Qinglang Miao
2020-07-27  1:29 ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).