kernel: dont use smalloc() to allocate pte array in ibrk()

when we'r out of kernel memory, it is probably better to
let that alloc fail instead of hanging while holding the
segment qlock.
This commit is contained in:
cinap_lenrek 2015-06-13 17:50:26 +02:00
parent 27fb90eb6e
commit d6eb7cc71c

View file

@ -437,7 +437,11 @@ ibrk(uintptr addr, int seg)
}
mapsize = ROUND(newsize, PTEPERTAB)/PTEPERTAB;
if(mapsize > s->mapsize){
map = smalloc(mapsize*sizeof(Pte*));
map = malloc(mapsize*sizeof(Pte*));
if(map == nil){
qunlock(s);
error(Enomem);
}
memmove(map, s->map, s->mapsize*sizeof(Pte*));
if(s->map != s->ssegmap)
free(s->map);