Skip to content

Commit

Permalink
cifs: Remove redundant multiplex identifier check from check_smb_hdr()
Browse files Browse the repository at this point in the history
The only call site for check_smb_header() assigns 'mid' from the SMB
packet, which is then checked again in check_smb_header(). This seems
like redundant redundancy.

Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Tim Gardner <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
rtg-tpi authored and smfrench committed Oct 28, 2013
1 parent 34f6264 commit 944d6f1
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions fs/cifs/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
}

static int
check_smb_hdr(struct smb_hdr *smb, __u16 mid)
check_smb_hdr(struct smb_hdr *smb)
{
/* does it have the right SMB "signature" ? */
if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) {
Expand All @@ -287,13 +287,6 @@ check_smb_hdr(struct smb_hdr *smb, __u16 mid)
return 1;
}

/* Make sure that message ids match */
if (mid != smb->Mid) {
cifs_dbg(VFS, "Mids do not match. received=%u expected=%u\n",
smb->Mid, mid);
return 1;
}

/* if it's a response then accept */
if (smb->Flags & SMBFLG_RESPONSE)
return 0;
Expand All @@ -310,7 +303,6 @@ int
checkSMB(char *buf, unsigned int total_read)
{
struct smb_hdr *smb = (struct smb_hdr *)buf;
__u16 mid = smb->Mid;
__u32 rfclen = be32_to_cpu(smb->smb_buf_length);
__u32 clc_len; /* calculated length */
cifs_dbg(FYI, "checkSMB Length: 0x%x, smb_buf_length: 0x%x\n",
Expand Down Expand Up @@ -348,7 +340,7 @@ checkSMB(char *buf, unsigned int total_read)
}

/* otherwise, there is enough to get to the BCC */
if (check_smb_hdr(smb, mid))
if (check_smb_hdr(smb))
return -EIO;
clc_len = smbCalcSize(smb);

Expand Down

0 comments on commit 944d6f1

Please sign in to comment.