diff options
author | unknown <jonas@perch.ndb.mysql.com> | 2006-08-03 14:01:37 +0200 |
---|---|---|
committer | unknown <jonas@perch.ndb.mysql.com> | 2006-08-03 14:01:37 +0200 |
commit | 42fd7e8f7d0ecae92bf154cf277dfe8dd5ba9f5f (patch) | |
tree | ef3eb6e17e9044b9657f4cb4165dad21998e7605 /ndb | |
parent | 753651c1db798da646b606b02b292919f1ffe04a (diff) | |
download | mariadb-git-42fd7e8f7d0ecae92bf154cf277dfe8dd5ba9f5f.tar.gz |
ndb - bug#20892
Fix bug in tup buddy allocator, which made it make invalid access to cfreepagelist[16] (which is not defined)
ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp:
loop from firstListToCheck -1 (as firstListToCheck has already been checked), when looking for less than requested pages
add if-statement for firtListToCheck == 0
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp b/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp index 9722aa437c0..8a18fddae19 100644 --- a/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp +++ b/ndb/src/kernel/blocks/dbtup/DbtupPagMan.cpp @@ -184,24 +184,28 @@ void Dbtup::allocConsPages(Uint32 noOfPagesToAllocate, /* PROPER AMOUNT OF PAGES WERE NOT FOUND. FIND AS MUCH AS */ /* POSSIBLE. */ /* ---------------------------------------------------------------- */ - for (Uint32 j = firstListToCheck; (Uint32)~j; j--) { + if (firstListToCheck) + { ljam(); - if (cfreepageList[j] != RNIL) { + for (Uint32 j = firstListToCheck - 1; (Uint32)~j; j--) { ljam(); + if (cfreepageList[j] != RNIL) { + ljam(); /* ---------------------------------------------------------------- */ /* SOME AREA WAS FOUND, ALLOCATE ALL OF IT. */ /* ---------------------------------------------------------------- */ - allocPageRef = cfreepageList[j]; - removeCommonArea(allocPageRef, j); - noOfPagesAllocated = 1 << j; - findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated, - noOfPagesToAllocate); - findFreeRightNeighbours(allocPageRef, noOfPagesAllocated, - noOfPagesToAllocate); - - return; - }//if - }//for + allocPageRef = cfreepageList[j]; + removeCommonArea(allocPageRef, j); + noOfPagesAllocated = 1 << j; + findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated, + noOfPagesToAllocate); + findFreeRightNeighbours(allocPageRef, noOfPagesAllocated, + noOfPagesToAllocate); + + return; + }//if + }//for + } /* ---------------------------------------------------------------- */ /* NO FREE AREA AT ALL EXISTED. RETURN ZERO PAGES */ /* ---------------------------------------------------------------- */ |