Commit 42fd7e8f authored by unknown's avatar unknown

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
parent 753651c1
...@@ -184,24 +184,28 @@ void Dbtup::allocConsPages(Uint32 noOfPagesToAllocate, ...@@ -184,24 +184,28 @@ void Dbtup::allocConsPages(Uint32 noOfPagesToAllocate,
/* PROPER AMOUNT OF PAGES WERE NOT FOUND. FIND AS MUCH AS */ /* PROPER AMOUNT OF PAGES WERE NOT FOUND. FIND AS MUCH AS */
/* POSSIBLE. */ /* POSSIBLE. */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
for (Uint32 j = firstListToCheck; (Uint32)~j; j--) { if (firstListToCheck)
{
ljam(); ljam();
if (cfreepageList[j] != RNIL) { for (Uint32 j = firstListToCheck - 1; (Uint32)~j; j--) {
ljam(); ljam();
if (cfreepageList[j] != RNIL) {
ljam();
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* SOME AREA WAS FOUND, ALLOCATE ALL OF IT. */ /* SOME AREA WAS FOUND, ALLOCATE ALL OF IT. */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
allocPageRef = cfreepageList[j]; allocPageRef = cfreepageList[j];
removeCommonArea(allocPageRef, j); removeCommonArea(allocPageRef, j);
noOfPagesAllocated = 1 << j; noOfPagesAllocated = 1 << j;
findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated, findFreeLeftNeighbours(allocPageRef, noOfPagesAllocated,
noOfPagesToAllocate); noOfPagesToAllocate);
findFreeRightNeighbours(allocPageRef, noOfPagesAllocated, findFreeRightNeighbours(allocPageRef, noOfPagesAllocated,
noOfPagesToAllocate); noOfPagesToAllocate);
return; return;
}//if }//if
}//for }//for
}
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
/* NO FREE AREA AT ALL EXISTED. RETURN ZERO PAGES */ /* NO FREE AREA AT ALL EXISTED. RETURN ZERO PAGES */
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment