- Timestamp:
- Apr 5, 2020 10:40:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp
r83499 r83575 918 918 { 919 919 PVIRTIOSGSEG paSeg = &pSgPhysReturn->paSegs[pSgPhysReturn->idxSeg]; 920 uint64_t dstSgStart = (uint64_t)paSeg->gcPhys; 921 uint64_t dstSgLen = (uint64_t)paSeg->cbSeg; 922 uint64_t dstSgCur = (uint64_t)pSgPhysReturn->gcPhysCur; 923 cbCopy = RT_MIN((uint64_t)pSgVirtReturn->cbSegLeft, dstSgLen - (dstSgCur - dstSgStart)); 920 /** @todo r=bird: Shouldn't this be: RT_MIN(pSgVirtReturn->cbSegLeft, pSgPhysReturn->cbSegLeft); */ 921 cbCopy = RT_MIN(pSgVirtReturn->cbSegLeft, paSeg->cbSeg - (size_t)(pSgPhysReturn->gcPhysCur - paSeg->gcPhys)); 922 Assert(cbCopy > 0); /** @todo r=bird: There is no check that there is sufficient space in the output 923 * buffer (pSgPhysReturn), so we might loop here forever if the caller is careless, 924 * right? I'm pretty sure virtioScsiR3SendEvent could do more checks. */ 924 925 PDMDevHlpPhysWrite(pDevIns, (RTGCPHYS)pSgPhysReturn->gcPhysCur, pSgVirtReturn->pvSegCur, cbCopy); 925 926 RTSgBufAdvance(pSgVirtReturn, cbCopy); … … 946 947 if (pSgVirtReturn) 947 948 Log6Func((".... Copied %zu bytes in %d segs to %u byte buffer, residual=%zu\n", 948 cbTotal - cbRemain, pSgVirtReturn->cSegs, pDescChain->cbPhysReturn, pDescChain->cbPhysReturn - cbTotal));949 cbTotal - cbRemain, pSgVirtReturn->cSegs, pDescChain->cbPhysReturn, pDescChain->cbPhysReturn - cbTotal)); 949 950 950 951 Log6Func(("Write ahead used_idx=%u, %s used_idx=%u\n", … … 953 954 if (pDescChain->pSgPhysSend) 954 955 { 955 RTMemFree( (void *)pDescChain->pSgPhysSend->paSegs);956 RTMemFree(pDescChain->pSgPhysSend->paSegs); 956 957 RTMemFree(pDescChain->pSgPhysSend); 957 958 } 958 959 if (pDescChain->pSgPhysReturn) 959 960 { 960 RTMemFree( (void *)pSgPhysReturn->paSegs);961 RTMemFree(pSgPhysReturn->paSegs); 961 962 RTMemFree(pSgPhysReturn); 962 963 }
Note:
See TracChangeset
for help on using the changeset viewer.