Fixed upage_alloc bug with page-coloring disabled
authorAndrew Waterman <waterman@ros-dev.(none)>
Mon, 5 Apr 2010 01:18:55 +0000 (18:18 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:39 +0000 (17:35 -0700)
We forgot to zero-fill the page if requested.  This bug
was a bear and took about 3 hours to track down :|

kern/src/page_alloc.c

index f263dba..6531c3a 100644 (file)
@@ -142,6 +142,8 @@ error_t upage_alloc(struct proc* p, page_t** page, int zero)
                ret = __page_alloc_from_color_range(page, 0, global_next_color);
 
        if(ret >= 0) {
+               if(zero)
+                       memset(page2kva(*page),0,PGSIZE);
                global_next_color = ret;        
                ret = ESUCCESS;
        }