From e9af397dc7a178fba55477e58089723855b3a1af Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sat, 6 Feb 2021 13:33:27 +0100 Subject: pc, pc64: warn when running out of conf.mem[] entries in meminit() --- sys/src/9/pc/memory.c | 7 +++++-- 1 file 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(); -- cgit v1.2.3