From 377f081251540e33743a8d8bc59d05e68d4e2782 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 19 Sep 2014 10:35:06 -0400 Subject: [PATCH] mem: Check return value of checkFunctional in SimpleMemory Simple fix to ensure we only iterate until we are done. --- src/mem/simple_mem.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mem/simple_mem.cc b/src/mem/simple_mem.cc index 2549cbe39..b2d518dc7 100644 --- a/src/mem/simple_mem.cc +++ b/src/mem/simple_mem.cc @@ -80,9 +80,13 @@ SimpleMemory::recvFunctional(PacketPtr pkt) functionalAccess(pkt); + bool done = false; + auto p = packetQueue.begin(); // potentially update the packets in our packet queue as well - for (auto i = packetQueue.begin(); i != packetQueue.end(); ++i) - pkt->checkFunctional(i->pkt); + while (!done && p != packetQueue.end()) { + done = pkt->checkFunctional(p->pkt); + ++p; + } pkt->popLabel(); }