Correct size comparison (pages vs. sections)

This commit is contained in:
Gregory Nutt 2014-09-07 12:06:24 -06:00
parent 5849298be8
commit 089a49d869

View File

@ -173,10 +173,13 @@ static int up_addrenv_create_region(FAR uintptr_t **list,
/* Verify that we are configured with enough virtual address space to
* support this memory region.
*
* npages pages correspondes to (npages << MM_PGSHIFT) bytes
* listlen sections corresponds to (listlen << 20) bytes
*/
npages = MM_NPAGES(regionsize);
if (npages > listlen)
if (npages > (listlen << (20 - MM_PGSHIFT)))
{
bdbg("ERROR: npages=%u listlen=%u\n", npages, listlen);
return -E2BIG;