Skip to contentSkip to conversation

cifs: convert to use be32_add_cpu()

PATCH Applied Qinglang Miao 2 participants 2 messages Jul 25, 2020 – Jul 27, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: convert to use be32_add_cpu()

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

---
 fs/cifs/connect.c | 3 +--
 fs/cifs/sess.c    | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
fs/cifs/connect.c +1 -2
index 889fee586..552975420 100644
@@ -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,
fs/cifs/sess.c +1 -2
index 6708ab0aa..69cd58566 100644
@@ -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,
Signature · 1 line
2.25.1
Applied
#1 lore raw

merged into cifs-2.6.git for-next

and for-next also updated with 5.8-rc7

Quoted 40 lines · Qinglang Miao

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

---
 fs/cifs/connect.c | 3 +--
 fs/cifs/sess.c    | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
fs/cifs/connect.c +1 -2
index 889fee586..552975420 100644
@@ -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,
fs/cifs/sess.c +1 -3
index 6708ab0aa..69cd58566 100644
@@ -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

Signature · 3 lines
Thanks,

Steve