Commit 23eb45fe authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

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

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 35970452
...@@ -700,28 +700,28 @@ typedef struct smb_com_read_req { ...@@ -700,28 +700,28 @@ typedef struct smb_com_read_req {
struct smb_hdr hdr; /* wct = 12 */ struct smb_hdr hdr; /* wct = 12 */
__u8 AndXCommand; __u8 AndXCommand;
__u8 AndXReserved; __u8 AndXReserved;
__u16 AndXOffset; __le16 AndXOffset;
__u16 Fid; __u16 Fid;
__u32 OffsetLow; __le32 OffsetLow;
__u16 MaxCount; __le16 MaxCount;
__u16 MinCount; /* obsolete */ __le16 MinCount; /* obsolete */
__u32 MaxCountHigh; __le32 MaxCountHigh;
__u16 Remaining; __le16 Remaining;
__u32 OffsetHigh; __le32 OffsetHigh;
__u16 ByteCount; __le16 ByteCount;
} READ_REQ; } READ_REQ;
typedef struct smb_com_read_rsp { typedef struct smb_com_read_rsp {
struct smb_hdr hdr; /* wct = 12 */ struct smb_hdr hdr; /* wct = 12 */
__u8 AndXCommand; __u8 AndXCommand;
__u8 AndXReserved; __u8 AndXReserved;
__u16 AndXOffset; __le16 AndXOffset;
__u16 Remaining; __le16 Remaining;
__u16 DataCompactionMode; __le16 DataCompactionMode;
__u16 Reserved; __le16 Reserved;
__u16 DataLength; __le16 DataLength;
__u16 DataOffset; __le16 DataOffset;
__u16 DataLengthHigh; __le16 DataLengthHigh;
__u64 Reserved2; __u64 Reserved2;
__u16 ByteCount; __u16 ByteCount;
__u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */
......
...@@ -697,24 +697,24 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, ...@@ -697,24 +697,24 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon,
if (rc) { if (rc) {
cERROR(1, ("Send error in read = %d", rc)); cERROR(1, ("Send error in read = %d", rc));
} else { } else {
pSMBr->DataLength = le16_to_cpu(pSMBr->DataLength); __u16 data_length = le16_to_cpu(pSMBr->DataLength);
*nbytes = pSMBr->DataLength; *nbytes = data_length;
/*check that DataLength would not go beyond end of SMB */ /*check that DataLength would not go beyond end of SMB */
if ((pSMBr->DataLength > CIFS_MAX_MSGSIZE) if ((data_length > CIFS_MAX_MSGSIZE)
|| (pSMBr->DataLength > count)) { || (data_length > count)) {
cFYI(1,("bad length %d for count %d",pSMBr->DataLength,count)); cFYI(1,("bad length %d for count %d",data_length,count));
rc = -EIO; rc = -EIO;
*nbytes = 0; *nbytes = 0;
} else { } else {
pReadData = pReadData =
(char *) (&pSMBr->hdr.Protocol) + (char *) (&pSMBr->hdr.Protocol) +
le16_to_cpu(pSMBr->DataOffset); le16_to_cpu(pSMBr->DataOffset);
/* if(rc = copy_to_user(buf, pReadData, pSMBr->DataLength)) { /* if(rc = copy_to_user(buf, pReadData, data_length)) {
cERROR(1,("Faulting on read rc = %d",rc)); cERROR(1,("Faulting on read rc = %d",rc));
rc = -EFAULT; rc = -EFAULT;
}*/ /* can not use copy_to_user when using page cache*/ }*/ /* can not use copy_to_user when using page cache*/
if(*buf) if(*buf)
memcpy(*buf,pReadData,pSMBr->DataLength); memcpy(*buf,pReadData,data_length);
} }
} }
if (pSMB) { if (pSMB) {
......
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