Changeset 27181 in vbox
- Timestamp:
- Mar 8, 2010 5:26:35 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/ISCSIHDDCore.cpp
r26960 r27181 1426 1426 uint32_t *pDst = NULL; 1427 1427 size_t cbBufLength; 1428 uint32_t aStat [64];1428 uint32_t aStatus[256]; /**< Plenty of buffer for status information. */ 1429 1429 uint32_t ExpDataSN = 0; 1430 1430 bool final = false; … … 1525 1525 /* Always reserve space for the status - it's impossible to tell 1526 1526 * beforehand whether this will be the final PDU or not. */ 1527 aISCSIRes[cnISCSIRes].pvSeg = aStat ;1528 aISCSIRes[cnISCSIRes].cbSeg = sizeof(aStat );1527 aISCSIRes[cnISCSIRes].pvSeg = aStatus; 1528 aISCSIRes[cnISCSIRes].cbSeg = sizeof(aStatus); 1529 1529 cnISCSIRes++; 1530 1530 … … 1555 1555 { 1556 1556 uint32_t cbStat = RT_N2H_U32(((uint32_t *)aISCSIRes[1].pvSeg)[0]) >> 16; 1557 if (cbStat + 2 > cbData || cbStat > pRequest->cbSense)1557 if (cbStat + 2 > cbData) 1558 1558 { 1559 1559 rc = VERR_BUFFER_OVERFLOW; 1560 1560 break; 1561 1561 } 1562 pRequest->cbSense = cbStat; 1563 memcpy(pRequest->pvSense, ((const uint8_t *)aISCSIRes[1].pvSeg) + 2, aISCSIRes[1].cbSeg - 2); 1564 if (cnISCSIRes > 2 && aISCSIRes[2].cbSeg && (ssize_t)cbStat - aISCSIRes[1].cbSeg - 2 > 0) 1565 memcpy((char *)pRequest->pvSense + aISCSIRes[1].cbSeg, aISCSIRes[2].pvSeg, cbStat - aISCSIRes[1].cbSeg - 2); 1562 /* Truncate sense data if it doesn't fit into the buffer. */ 1563 pRequest->cbSense = RT_MIN(cbStat, pRequest->cbSense); 1564 memcpy(pRequest->pvSense, 1565 ((const char *)aISCSIRes[1].pvSeg) + 2, 1566 RT_MIN(aISCSIRes[1].cbSeg - 2, pRequest->cbSense)); 1567 if ( cnISCSIRes > 2 && aISCSIRes[2].cbSeg 1568 && (ssize_t)pRequest->cbSense - aISCSIRes[1].cbSeg + 2 > 0) 1569 { 1570 memcpy((char *)pRequest->pvSense + aISCSIRes[1].cbSeg - 2, 1571 aISCSIRes[2].pvSeg, 1572 pRequest->cbSense - aISCSIRes[1].cbSeg + 2); 1573 } 1566 1574 } 1567 1575 else if (cbData == 1) … … 2538 2546 2539 2547 SCSIREQ sr; 2540 uint8_t sense[ 32];2548 uint8_t sense[96]; 2541 2549 uint8_t data8[8]; 2542 2550 uint8_t data12[12]; … … 3010 3018 SCSIREQ sr; 3011 3019 uint8_t cdb[10]; 3012 uint8_t sense[ 32];3020 uint8_t sense[96]; 3013 3021 3014 3022 cdb[0] = SCSI_READ_10; … … 3091 3099 SCSIREQ sr; 3092 3100 uint8_t cdb[10]; 3093 uint8_t sense[ 32];3101 uint8_t sense[96]; 3094 3102 3095 3103 cdb[0] = SCSI_WRITE_10; … … 3147 3155 SCSIREQ sr; 3148 3156 uint8_t cdb[10]; 3149 uint8_t sense[ 32];3157 uint8_t sense[96]; 3150 3158 3151 3159 cdb[0] = SCSI_SYNCHRONIZE_CACHE;
Note:
See TracChangeset
for help on using the changeset viewer.