summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mem/packet.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mem/packet.cc b/src/mem/packet.cc
index fa8d82c46..a342af634 100644
--- a/src/mem/packet.cc
+++ b/src/mem/packet.cc
@@ -182,11 +182,11 @@ fixPacket(PacketPtr func, PacketPtr timing)
if (funcStart >= timingStart) {
memcpy(timing->getPtr<uint8_t>() + (funcStart - timingStart),
func->getPtr<uint8_t>(),
- funcStart - std::min(funcEnd, timingEnd));
+ std::min(funcEnd, timingEnd) - funcStart);
} else { // timingStart > funcStart
memcpy(timing->getPtr<uint8_t>(),
func->getPtr<uint8_t>() + (timingStart - funcStart),
- timingStart - std::min(funcEnd, timingEnd));
+ std::min(funcEnd, timingEnd) - timingStart);
}
// we always want to keep going with a write
return true;