changeset dc0ed2d4da50 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=dc0ed2d4da50
description:
        mem: Avoid using invalid iterator in cache lock list traversal

        Fix up issue highlighted by Valgrind and the clang Address Sanitizer.

diffstat:

 src/mem/cache/blk.hh |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r c45bfadcd51b -r dc0ed2d4da50 src/mem/cache/blk.hh
--- a/src/mem/cache/blk.hh      Sun Feb 14 20:28:48 2016 -0500
+++ b/src/mem/cache/blk.hh      Mon Feb 15 03:40:04 2016 -0500
@@ -347,15 +347,16 @@
             bool success = false;
 
             auto l = lockList.begin();
-            while (l != lockList.end() && !success) {
+            while (!success && l != lockList.end()) {
                 if (l->matches(pkt->req)) {
                     // it's a store conditional, and as far as the
                     // memory system can tell, the requesting
                     // context's lock is still valid.
                     success = true;
                     lockList.erase(l);
+                } else {
+                    ++l;
                 }
-                ++l;
             }
 
             req->setExtraData(success ? 1 : 0);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to