struct smb_hdr hdr; /* wct = 12 */
__u8 AndXCommand;
__u8 AndXReserved;
- __u16 AndXOffset;
+ __le16 AndXOffset;
__u16 Fid;
- __u32 OffsetLow;
- __u16 MaxCount;
- __u16 MinCount; /* obsolete */
- __u32 MaxCountHigh;
- __u16 Remaining;
- __u32 OffsetHigh;
- __u16 ByteCount;
+ __le32 OffsetLow;
+ __le16 MaxCount;
+ __le16 MinCount; /* obsolete */
+ __le32 MaxCountHigh;
+ __le16 Remaining;
+ __le32 OffsetHigh;
+ __le16 ByteCount;
} READ_REQ;
typedef struct smb_com_read_rsp {
struct smb_hdr hdr; /* wct = 12 */
__u8 AndXCommand;
__u8 AndXReserved;
- __u16 AndXOffset;
- __u16 Remaining;
- __u16 DataCompactionMode;
- __u16 Reserved;
- __u16 DataLength;
- __u16 DataOffset;
- __u16 DataLengthHigh;
+ __le16 AndXOffset;
+ __le16 Remaining;
+ __le16 DataCompactionMode;
+ __le16 Reserved;
+ __le16 DataLength;
+ __le16 DataOffset;
+ __le16 DataLengthHigh;
__u64 Reserved2;
__u16 ByteCount;
__u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */
if (rc) {
cERROR(1, ("Send error in read = %d", rc));
} else {
- pSMBr->DataLength = le16_to_cpu(pSMBr->DataLength);
- *nbytes = pSMBr->DataLength;
+ __u16 data_length = le16_to_cpu(pSMBr->DataLength);
+ *nbytes = data_length;
/*check that DataLength would not go beyond end of SMB */
- if ((pSMBr->DataLength > CIFS_MAX_MSGSIZE)
- || (pSMBr->DataLength > count)) {
- cFYI(1,("bad length %d for count %d",pSMBr->DataLength,count));
+ if ((data_length > CIFS_MAX_MSGSIZE)
+ || (data_length > count)) {
+ cFYI(1,("bad length %d for count %d",data_length,count));
rc = -EIO;
*nbytes = 0;
} else {
pReadData =
(char *) (&pSMBr->hdr.Protocol) +
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));
rc = -EFAULT;
}*/ /* can not use copy_to_user when using page cache*/
if(*buf)
- memcpy(*buf,pReadData,pSMBr->DataLength);
+ memcpy(*buf,pReadData,data_length);
}
}
if (pSMB) {