mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 09:12:44 +00:00
The zalloc pool's size calculation breaks if sbrk() does not return
contiguous chunks of memory. It happens to do so in the bootstrap code, but not necessarily in other places. MFC after: 7 days
This commit is contained in:
parent
86fea6be59
commit
914d31686b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=108108
@ -247,22 +247,22 @@ zextendPool(MemPool *mp, void *base, iaddr_t bytes)
|
||||
mp->mp_Base = base;
|
||||
mp->mp_Used = bytes;
|
||||
mp->mp_End = (char *)base + bytes;
|
||||
mp->mp_Size = bytes;
|
||||
} else {
|
||||
void *pend = (char *)mp->mp_Base + mp->mp_Size;
|
||||
|
||||
if (base < mp->mp_Base) {
|
||||
/* mp->mp_Size += (char *)mp->mp_Base - (char *)base; */
|
||||
mp->mp_Size += (char *)mp->mp_Base - (char *)base;
|
||||
mp->mp_Used += (char *)mp->mp_Base - (char *)base;
|
||||
mp->mp_Base = base;
|
||||
}
|
||||
base = (char *)base + bytes;
|
||||
if (base > pend) {
|
||||
/* mp->mp_Size += (char *)base - (char *)pend; */
|
||||
mp->mp_Size += (char *)base - (char *)pend;
|
||||
mp->mp_Used += (char *)base - (char *)pend;
|
||||
mp->mp_End = (char *)base;
|
||||
}
|
||||
}
|
||||
mp->mp_Size += bytes;
|
||||
}
|
||||
|
||||
#ifdef ZALLOCDEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user