Commit f3db6d91 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cifs: annotate TRANSACTION2_FNEXT_{REQ,RESP}

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 34f8ef1e
...@@ -1292,43 +1292,43 @@ typedef struct smb_com_transaction2_ffirst_rsp_parms { ...@@ -1292,43 +1292,43 @@ typedef struct smb_com_transaction2_ffirst_rsp_parms {
typedef struct smb_com_transaction2_fnext_req { typedef struct smb_com_transaction2_fnext_req {
struct smb_hdr hdr; /* wct = 15 */ struct smb_hdr hdr; /* wct = 15 */
__u16 TotalParameterCount; __le16 TotalParameterCount;
__u16 TotalDataCount; __le16 TotalDataCount;
__u16 MaxParameterCount; __le16 MaxParameterCount;
__u16 MaxDataCount; __le16 MaxDataCount;
__u8 MaxSetupCount; __u8 MaxSetupCount;
__u8 Reserved; __u8 Reserved;
__u16 Flags; __le16 Flags;
__u32 Timeout; __le32 Timeout;
__u16 Reserved2; __u16 Reserved2;
__u16 ParameterCount; __le16 ParameterCount;
__u16 ParameterOffset; __le16 ParameterOffset;
__u16 DataCount; __le16 DataCount;
__u16 DataOffset; __le16 DataOffset;
__u8 SetupCount; /* one */ __u8 SetupCount; /* one */
__u8 Reserved3; __u8 Reserved3;
__u16 SubCommand; /* TRANS2_FIND_NEXT */ __le16 SubCommand; /* TRANS2_FIND_NEXT */
__u16 ByteCount; __le16 ByteCount;
__u8 Pad; __u8 Pad;
__u16 SearchHandle; __u16 SearchHandle;
__u16 SearchCount; __le16 SearchCount;
__u16 InformationLevel; __le16 InformationLevel;
__u32 ResumeKey; __u32 ResumeKey;
__u16 SearchFlags; __le16 SearchFlags;
char ResumeFileName[1]; char ResumeFileName[1];
} TRANSACTION2_FNEXT_REQ; } TRANSACTION2_FNEXT_REQ;
typedef struct smb_com_transaction2_fnext_rsp { typedef struct smb_com_transaction2_fnext_rsp {
struct smb_hdr hdr; /* wct = 10 */ struct smb_hdr hdr; /* wct = 10 */
__u16 TotalParameterCount; __le16 TotalParameterCount;
__u16 TotalDataCount; __le16 TotalDataCount;
__u16 Reserved; __u16 Reserved;
__u16 ParameterCount; __le16 ParameterCount;
__u16 ParameterOffset; __le16 ParameterOffset;
__u16 ParameterDisplacement; __le16 ParameterDisplacement;
__u16 DataCount; __le16 DataCount;
__u16 DataOffset; __le16 DataOffset;
__u16 DataDisplacement; __le16 DataDisplacement;
__u8 SetupCount; __u8 SetupCount;
__u8 Reserved1; /* should be zero setup words following */ __u8 Reserved1; /* should be zero setup words following */
__u16 ByteCount; __u16 ByteCount;
......
...@@ -1921,6 +1921,7 @@ CIFSFindNext(const int xid, struct cifsTconInfo *tcon, ...@@ -1921,6 +1921,7 @@ CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
char *response_data; char *response_data;
int rc = 0; int rc = 0;
int bytes_returned; int bytes_returned;
__u16 params, byte_count;
cFYI(1, ("In FindNext")); cFYI(1, ("In FindNext"));
...@@ -1932,7 +1933,8 @@ CIFSFindNext(const int xid, struct cifsTconInfo *tcon, ...@@ -1932,7 +1933,8 @@ CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
if (rc) if (rc)
return rc; return rc;
pSMB->TotalParameterCount = 14; /* includes 2 bytes of null string, converted to LE below */ params = 14; /* includes 2 bytes of null string, converted to LE below */
byte_count = 0;
pSMB->TotalDataCount = 0; /* no EAs */ pSMB->TotalDataCount = 0; /* no EAs */
pSMB->MaxParameterCount = cpu_to_le16(8); pSMB->MaxParameterCount = cpu_to_le16(8);
pSMB->MaxDataCount = pSMB->MaxDataCount =
...@@ -1968,15 +1970,15 @@ CIFSFindNext(const int xid, struct cifsTconInfo *tcon, ...@@ -1968,15 +1970,15 @@ CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
/* BB add check to make sure we do not cross end of smb */ /* BB add check to make sure we do not cross end of smb */
if(name_len < CIFS_MAX_MSGSIZE) { if(name_len < CIFS_MAX_MSGSIZE) {
memcpy(pSMB->ResumeFileName, resume_file_name, name_len); memcpy(pSMB->ResumeFileName, resume_file_name, name_len);
pSMB->ByteCount += name_len; byte_count += name_len;
} }
pSMB->TotalParameterCount += name_len; params += name_len;
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; byte_count = params + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); pSMB->TotalParameterCount = cpu_to_le16(params);
pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterCount = pSMB->TotalParameterCount;
/* BB improve error handling here */ /* BB improve error handling here */
pSMB->hdr.smb_buf_length += pSMB->ByteCount; pSMB->hdr.smb_buf_length += byte_count;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); pSMB->ByteCount = cpu_to_le16(byte_count);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0); (struct smb_hdr *) pSMBr, &bytes_returned, 0);
......
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