diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-02-06 13:33:27 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-02-06 13:33:27 +0100 |
commit | e9af397dc7a178fba55477e58089723855b3a1af (patch) | |
tree | d4f5f2f37f271a75661483eea5ccfdcc77679651 | |
parent | 01ab07ef729a2dbade38906f4acf2827ea327952 (diff) | |
download | plan9front-e9af397dc7a178fba55477e58089723855b3a1af.tar.xz |
pc, pc64: warn when running out of conf.mem[] entries in meminit()
-rw-r--r-- | sys/src/9/pc/memory.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/9/pc/memory.c b/sys/src/9/pc/memory.c index 6df499728..8853d4c0b 100644 --- a/sys/src/9/pc/memory.c +++ b/sys/src/9/pc/memory.c @@ -568,13 +568,16 @@ meminit(void) size = memmapsize(base, BY2PG) & ~(BY2PG-1); if(size == 0) continue; + if(cm >= &conf.mem[nelem(conf.mem)]){ + print("meminit: out of entries, loosing: %#p (%llud)\n", base, (uvlong)size); + continue; + } cm->base = memmapalloc(base, size, BY2PG, MemRAM); if(cm->base == -1) continue; base = cm->base; cm->npage = size/BY2PG; - if(++cm >= &conf.mem[nelem(conf.mem)]) - break; + cm++; } if(0) memmapdump(); |