aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2008-12-08 19:28:16 -0500
committerSteve French <sfrench@us.ibm.com>2008-12-25 21:29:12 -0500
commit4c3130efda1ef4f28d5f26819fae2e58c3945f0b (patch)
tree586562ae7385a1fbe6b64a31f66522515d1c5726 /fs
parent27a97a613b96688e59dd116cae3f0c94107b434c (diff)
[CIFS] Cleanup: Move the check for too large R/W requests
This avoids an unnecessary else branch Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifssmb.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index ef9786b6bea4..824df142f288 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1414,8 +1414,13 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
1414 cFYI(1, ("Reading %d bytes on fid %d", count, netfid)); 1414 cFYI(1, ("Reading %d bytes on fid %d", count, netfid));
1415 if (tcon->ses->capabilities & CAP_LARGE_FILES) 1415 if (tcon->ses->capabilities & CAP_LARGE_FILES)
1416 wct = 12; 1416 wct = 12;
1417 else 1417 else {
1418 wct = 10; /* old style read */ 1418 wct = 10; /* old style read */
1419 if ((lseek >> 32) > 0) {
1420 /* can not handle this big offset for old */
1421 return -EIO;
1422 }
1423 }
1419 1424
1420 *nbytes = 0; 1425 *nbytes = 0;
1421 rc = small_smb_init(SMB_COM_READ_ANDX, wct, tcon, (void **) &pSMB); 1426 rc = small_smb_init(SMB_COM_READ_ANDX, wct, tcon, (void **) &pSMB);
@@ -1431,8 +1436,6 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, const int netfid,
1431 pSMB->OffsetLow = cpu_to_le32(lseek & 0xFFFFFFFF); 1436 pSMB->OffsetLow = cpu_to_le32(lseek & 0xFFFFFFFF);
1432 if (wct == 12) 1437 if (wct == 12)
1433 pSMB->OffsetHigh = cpu_to_le32(lseek >> 32); 1438 pSMB->OffsetHigh = cpu_to_le32(lseek >> 32);
1434 else if ((lseek >> 32) > 0) /* can not handle this big offset for old */
1435 return -EIO;
1436 1439
1437 pSMB->Remaining = 0; 1440 pSMB->Remaining = 0;
1438 pSMB->MaxCount = cpu_to_le16(count & 0xFFFF); 1441 pSMB->MaxCount = cpu_to_le16(count & 0xFFFF);
@@ -1519,8 +1522,13 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
1519 1522
1520 if (tcon->ses->capabilities & CAP_LARGE_FILES) 1523 if (tcon->ses->capabilities & CAP_LARGE_FILES)
1521 wct = 14; 1524 wct = 14;
1522 else 1525 else {
1523 wct = 12; 1526 wct = 12;
1527 if ((offset >> 32) > 0) {
1528 /* can not handle big offset for old srv */
1529 return -EIO;
1530 }
1531 }
1524 1532
1525 rc = smb_init(SMB_COM_WRITE_ANDX, wct, tcon, (void **) &pSMB, 1533 rc = smb_init(SMB_COM_WRITE_ANDX, wct, tcon, (void **) &pSMB,
1526 (void **) &pSMBr); 1534 (void **) &pSMBr);
@@ -1535,8 +1543,6 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
1535 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); 1543 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
1536 if (wct == 14) 1544 if (wct == 14)
1537 pSMB->OffsetHigh = cpu_to_le32(offset >> 32); 1545 pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
1538 else if ((offset >> 32) > 0) /* can not handle big offset for old srv */
1539 return -EIO;
1540 1546
1541 pSMB->Reserved = 0xFFFFFFFF; 1547 pSMB->Reserved = 0xFFFFFFFF;
1542 pSMB->WriteMode = 0; 1548 pSMB->WriteMode = 0;
@@ -1621,10 +1627,15 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
1621 1627
1622 cFYI(1, ("write2 at %lld %d bytes", (long long)offset, count)); 1628 cFYI(1, ("write2 at %lld %d bytes", (long long)offset, count));
1623 1629
1624 if (tcon->ses->capabilities & CAP_LARGE_FILES) 1630 if (tcon->ses->capabilities & CAP_LARGE_FILES) {
1625 wct = 14; 1631 wct = 14;
1626 else 1632 } else {
1627 wct = 12; 1633 wct = 12;
1634 if ((offset >> 32) > 0) {
1635 /* can not handle big offset for old srv */
1636 return -EIO;
1637 }
1638 }
1628 rc = small_smb_init(SMB_COM_WRITE_ANDX, wct, tcon, (void **) &pSMB); 1639 rc = small_smb_init(SMB_COM_WRITE_ANDX, wct, tcon, (void **) &pSMB);
1629 if (rc) 1640 if (rc)
1630 return rc; 1641 return rc;
@@ -1637,8 +1648,6 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
1637 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); 1648 pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF);
1638 if (wct == 14) 1649 if (wct == 14)
1639 pSMB->OffsetHigh = cpu_to_le32(offset >> 32); 1650 pSMB->OffsetHigh = cpu_to_le32(offset >> 32);
1640 else if ((offset >> 32) > 0) /* can not handle big offset for old srv */
1641 return -EIO;
1642 pSMB->Reserved = 0xFFFFFFFF; 1651 pSMB->Reserved = 0xFFFFFFFF;
1643 pSMB->WriteMode = 0; 1652 pSMB->WriteMode = 0;
1644 pSMB->Remaining = 0; 1653 pSMB->Remaining = 0;