Skip to content

Commit

Permalink
consistently use smb_buf_length as be32 for cifs (try 3)
Browse files Browse the repository at this point in the history
       There is one big endian field in the cifs protocol, the RFC1001
       length, which cifs code (unlike in the smb2 code) had been handling as
       u32 until the last possible moment, when it was converted to be32 (its
       native form) before sending on the wire.   To remove the last sparse
       endian warning, and to make this consistent with the smb2
       implementation  (which always treats the fields in their
       native size and endianness), convert all uses of smb_buf_length to
       be32.

       This version incorporates Christoph's comment about
       using be32_add_cpu, and fixes a typo in the second
       version of the patch.

Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
Steve French committed May 19, 2011
1 parent 9409ae5 commit be8e3b0
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 101 deletions.
2 changes: 1 addition & 1 deletion fs/cifs/cifsencrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu,
server->session_key.response, server->session_key.len);

crypto_shash_update(&server->secmech.sdescmd5->shash,
cifs_pdu->Protocol, cifs_pdu->smb_buf_length);
cifs_pdu->Protocol, be32_to_cpu(cifs_pdu->smb_buf_length));

rc = crypto_shash_final(&server->secmech.sdescmd5->shash, signature);

Expand Down
6 changes: 3 additions & 3 deletions fs/cifs/cifspdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@
#define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */

struct smb_hdr {
__u32 smb_buf_length; /* big endian on wire *//* BB length is only two
or three bytes - with one or two byte type preceding it that are
zero - we could mask the type byte off just in case BB */
__be32 smb_buf_length; /* BB length is only two (rarely three) bytes,
with one or two byte "type" preceding it that will be
zero - we could mask the type byte off */
__u8 Protocol[4];
__u8 Command;
union {
Expand Down
Loading

0 comments on commit be8e3b0

Please sign in to comment.