Commit b6b3624d authored by Zhang Xiaoxu's avatar Zhang Xiaoxu Committed by Steve French

cifs: Use help macro to get the mid header size

It's better to use MID_HEADER_SIZE because the unfolded expression
too long. No actual functional changes, minor readability improvement.
Signed-off-by: default avatarZhang Xiaoxu <zhangxiaoxu5@huawei.com>
Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 9789de8b
...@@ -558,6 +558,7 @@ struct smb_version_values { ...@@ -558,6 +558,7 @@ struct smb_version_values {
#define HEADER_SIZE(server) (server->vals->header_size) #define HEADER_SIZE(server) (server->vals->header_size)
#define MAX_HEADER_SIZE(server) (server->vals->max_header_size) #define MAX_HEADER_SIZE(server) (server->vals->max_header_size)
#define HEADER_PREAMBLE_SIZE(server) (server->vals->header_preamble_size) #define HEADER_PREAMBLE_SIZE(server) (server->vals->header_preamble_size)
#define MID_HEADER_SIZE(server) (HEADER_SIZE(server) - 1 - HEADER_PREAMBLE_SIZE(server))
/** /**
* CIFS superblock mount flags (mnt_cifs_flags) to consider when * CIFS superblock mount flags (mnt_cifs_flags) to consider when
......
...@@ -1065,8 +1065,7 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid) ...@@ -1065,8 +1065,7 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid)
/* now read the rest */ /* now read the rest */
length = cifs_read_from_socket(server, buf + HEADER_SIZE(server) - 1, length = cifs_read_from_socket(server, buf + HEADER_SIZE(server) - 1,
pdu_length - HEADER_SIZE(server) + 1 + pdu_length - MID_HEADER_SIZE(server));
HEADER_PREAMBLE_SIZE(server));
if (length < 0) if (length < 0)
return length; return length;
...@@ -1198,8 +1197,7 @@ cifs_demultiplex_thread(void *p) ...@@ -1198,8 +1197,7 @@ cifs_demultiplex_thread(void *p)
server->pdu_size = pdu_length; server->pdu_size = pdu_length;
/* make sure we have enough to get to the MID */ /* make sure we have enough to get to the MID */
if (server->pdu_size < HEADER_SIZE(server) - 1 - if (server->pdu_size < MID_HEADER_SIZE(server)) {
HEADER_PREAMBLE_SIZE(server)) {
cifs_server_dbg(VFS, "SMB response too short (%u bytes)\n", cifs_server_dbg(VFS, "SMB response too short (%u bytes)\n",
server->pdu_size); server->pdu_size);
cifs_reconnect(server, true); cifs_reconnect(server, true);
...@@ -1209,8 +1207,7 @@ cifs_demultiplex_thread(void *p) ...@@ -1209,8 +1207,7 @@ cifs_demultiplex_thread(void *p)
/* read down to the MID */ /* read down to the MID */
length = cifs_read_from_socket(server, length = cifs_read_from_socket(server,
buf + HEADER_PREAMBLE_SIZE(server), buf + HEADER_PREAMBLE_SIZE(server),
HEADER_SIZE(server) - 1 - MID_HEADER_SIZE(server));
HEADER_PREAMBLE_SIZE(server));
if (length < 0) if (length < 0)
continue; continue;
server->total_read += length; server->total_read += length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment