mem: Avoid using invalid iterator in cache lock list traversal
Fix up issue highlighted by Valgrind and the clang Address Sanitizer.
This commit is contained in:
parent
b181cea364
commit
407233f5d8
1 changed files with 3 additions and 2 deletions
5
src/mem/cache/blk.hh
vendored
5
src/mem/cache/blk.hh
vendored
|
@ -347,15 +347,16 @@ class CacheBlk
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue