提交 76e79edd 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

sanity check in kmalloc

上级 99569f4c
...@@ -43,6 +43,7 @@ morecore(int c, int b) ...@@ -43,6 +43,7 @@ morecore(int c, int b)
return -1; return -1;
int sz = 1 << b; int sz = 1 << b;
assert(sz >= sizeof(header));
for(char *q = p; q + sz <= p + PGSIZE; q += sz){ for(char *q = p; q + sz <= p + PGSIZE; q += sz){
struct header *h = (struct header *) q; struct header *h = (struct header *) q;
h->next = freelists[c].buckets[b]; h->next = freelists[c].buckets[b];
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论