提交 5443d130 编写于 作者: S Steve French

various endian fixes to cifs

make modules C=2 M=fs/cifs CF=-D__CHECK_ENDIAN__

Found for example:

 CHECK   fs/cifs/cifssmb.c
fs/cifs/cifssmb.c:728:22: warning: incorrect type in assignment (different base types)
fs/cifs/cifssmb.c:728:22:    expected unsigned short [unsigned] [usertype] Tid
fs/cifs/cifssmb.c:728:22:    got restricted __le16 [usertype] <noident>
fs/cifs/cifssmb.c:1883:45: warning: incorrect type in assignment (different base types)
fs/cifs/cifssmb.c:1883:45:    expected long long [signed] [usertype] fl_start
fs/cifs/cifssmb.c:1883:45:    got restricted __le64 [usertype] start
fs/cifs/cifssmb.c:1884:54: warning: restricted __le64 degrades to integer
fs/cifs/cifssmb.c:1885:58: warning: restricted __le64 degrades to integer
fs/cifs/cifssmb.c:1886:43: warning: incorrect type in assignment (different base types)
fs/cifs/cifssmb.c:1886:43:    expected unsigned int [unsigned] fl_pid
fs/cifs/cifssmb.c:1886:43:    got restricted __le32 [usertype] pid

In checking new smb2 code for missing endian conversions, I noticed
some endian errors had crept in over the last few releases into the
cifs code (symlink, ntlmssp, posix lock, and also a less problematic warning
in fscache).  A followon patch will address a few smb2 endian
problems.
Reviewed-by: NJeff Layton <jlayton@redhat.com>
Signed-off-by: NSteve French <sfrench@us.ibm.com>
上级 6da97910
...@@ -50,7 +50,7 @@ void cifs_fscache_unregister(void) ...@@ -50,7 +50,7 @@ void cifs_fscache_unregister(void)
*/ */
struct cifs_server_key { struct cifs_server_key {
uint16_t family; /* address family */ uint16_t family; /* address family */
uint16_t port; /* IP port */ __be16 port; /* IP port */
union { union {
struct in_addr ipv4_addr; struct in_addr ipv4_addr;
struct in6_addr ipv6_addr; struct in6_addr ipv6_addr;
......
...@@ -729,7 +729,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server) ...@@ -729,7 +729,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
return rc; return rc;
/* set up echo request */ /* set up echo request */
smb->hdr.Tid = cpu_to_le16(0xffff); smb->hdr.Tid = 0xffff;
smb->hdr.WordCount = 1; smb->hdr.WordCount = 1;
put_unaligned_le16(1, &smb->EchoCount); put_unaligned_le16(1, &smb->EchoCount);
put_bcc_le(1, &smb->hdr); put_bcc_le(1, &smb->hdr);
...@@ -1884,10 +1884,10 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, ...@@ -1884,10 +1884,10 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
__constant_cpu_to_le16(CIFS_WRLCK)) __constant_cpu_to_le16(CIFS_WRLCK))
pLockData->fl_type = F_WRLCK; pLockData->fl_type = F_WRLCK;
pLockData->fl_start = parm_data->start; pLockData->fl_start = le64_to_cpu(parm_data->start);
pLockData->fl_end = parm_data->start + pLockData->fl_end = pLockData->fl_start +
parm_data->length - 1; le64_to_cpu(parm_data->length) - 1;
pLockData->fl_pid = parm_data->pid; pLockData->fl_pid = le32_to_cpu(parm_data->pid);
} }
} }
......
...@@ -239,7 +239,7 @@ CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon, ...@@ -239,7 +239,7 @@ CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon,
if (rc != 0) if (rc != 0)
return rc; return rc;
if (file_info.EndOfFile != CIFS_MF_SYMLINK_FILE_SIZE) { if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) {
CIFSSMBClose(xid, tcon, netfid); CIFSSMBClose(xid, tcon, netfid);
/* it's not a symlink */ /* it's not a symlink */
return -EINVAL; return -EINVAL;
...@@ -316,7 +316,7 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr, ...@@ -316,7 +316,7 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr,
if (rc != 0) if (rc != 0)
goto out; goto out;
if (file_info.EndOfFile != CIFS_MF_SYMLINK_FILE_SIZE) { if (file_info.EndOfFile != cpu_to_le64(CIFS_MF_SYMLINK_FILE_SIZE)) {
CIFSSMBClose(xid, pTcon, netfid); CIFSSMBClose(xid, pTcon, netfid);
/* it's not a symlink */ /* it's not a symlink */
goto out; goto out;
......
...@@ -404,8 +404,8 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, ...@@ -404,8 +404,8 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
/* BB spec says that if AvId field of MsvAvTimestamp is populated then /* BB spec says that if AvId field of MsvAvTimestamp is populated then
we must set the MIC field of the AUTHENTICATE_MESSAGE */ we must set the MIC field of the AUTHENTICATE_MESSAGE */
ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags); ses->ntlmssp->server_flags = le32_to_cpu(pblob->NegotiateFlags);
tioffset = cpu_to_le16(pblob->TargetInfoArray.BufferOffset); tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset);
tilen = cpu_to_le16(pblob->TargetInfoArray.Length); tilen = le16_to_cpu(pblob->TargetInfoArray.Length);
if (tilen) { if (tilen) {
ses->auth_key.response = kmalloc(tilen, GFP_KERNEL); ses->auth_key.response = kmalloc(tilen, GFP_KERNEL);
if (!ses->auth_key.response) { if (!ses->auth_key.response) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册