浏览代码

cifs: assorted endian annotations

fs/cifs/cifssmb.c:3917:13: warning: incorrect type in assignment (different base types)
fs/cifs/cifssmb.c:3917:13:    expected bool [unsigned] [usertype] is_unicode
fs/cifs/cifssmb.c:3917:13:    got restricted __le16

The comment explains why __force is used here.
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32
fs/cifs/connect.c:458:16: warning: cast to restricted __be32

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Harvey Harrison 17 年之前
父节点
当前提交
5ca33c6ac3
共有 2 个文件被更改,包括 5 次插入2 次删除
  1. 4 1
      fs/cifs/cifssmb.c
  2. 1 1
      fs/cifs/connect.c

+ 4 - 1
fs/cifs/cifssmb.c

@@ -3914,7 +3914,10 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr,
 	bool is_unicode;
 	bool is_unicode;
 	struct dfs_referral_level_3 *ref;
 	struct dfs_referral_level_3 *ref;
 
 
-	is_unicode = pSMBr->hdr.Flags2 & SMBFLG2_UNICODE;
+	if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE)
+		is_unicode = true;
+	else
+		is_unicode = false;
 	*num_of_nodes = le16_to_cpu(pSMBr->NumberOfReferrals);
 	*num_of_nodes = le16_to_cpu(pSMBr->NumberOfReferrals);
 
 
 	if (*num_of_nodes < 1) {
 	if (*num_of_nodes < 1) {

+ 1 - 1
fs/cifs/connect.c

@@ -455,7 +455,7 @@ incomplete_rcv:
 		/* Note that FC 1001 length is big endian on the wire,
 		/* Note that FC 1001 length is big endian on the wire,
 		but we convert it here so it is always manipulated
 		but we convert it here so it is always manipulated
 		as host byte order */
 		as host byte order */
-		pdu_length = ntohl(smb_buffer->smb_buf_length);
+		pdu_length = be32_to_cpu((__force __be32)smb_buffer->smb_buf_length);
 		smb_buffer->smb_buf_length = pdu_length;
 		smb_buffer->smb_buf_length = pdu_length;
 
 
 		cFYI(1, ("rfc1002 length 0x%x", pdu_length+4));
 		cFYI(1, ("rfc1002 length 0x%x", pdu_length+4));