Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Lots of pedantic error checking in Palacios proper, especially for memory
[palacios.git] / palacios / src / palacios / mmu / vmm_shdw_pg_swapbypass.c
index 0b0a776..001e917 100644 (file)
@@ -206,6 +206,12 @@ static addr_t map_swp_page(struct v3_vm_info * vm, pte32_t * shadow_pte, pte32_t
 
     if (shdw_ptr_list == NULL) {
        shdw_ptr_list = (struct list_head *)V3_Malloc(sizeof(struct list_head));
+
+       if (!shdw_ptr_list) {
+           PrintError("Cannot allocate\n");
+           return 0;
+       }
+
 #ifdef V3_CONFIG_SWAPBYPASS_TELEMETRY
        swap_state->list_size++;
 #endif
@@ -272,8 +278,19 @@ static struct shadow_page_data * create_new_shadow_pt(struct guest_info * core)
     // else  
 
     page_tail = (struct shadow_page_data *)V3_Malloc(sizeof(struct shadow_page_data));
+
+    if (!page_tail) {
+       PrintError("Cannot allocate\n");
+       return -1;
+    }
+
     page_tail->page_pa = (addr_t)V3_AllocPages(1);
 
+    if (!page_tail->page_pa) {
+       PrintError("Cannot allocate page\n");
+       return NULL;
+    }
+
     PrintDebug("Allocating new shadow Page: %p (cur_cr3=%p)\n", 
               (void *)(addr_t)page_tail->page_pa, 
               (void *)(addr_t)cur_cr3);
@@ -419,6 +436,12 @@ static int sb_local_init(struct guest_info * core) {
 
     swapbypass_state = (struct swapbypass_local_state *)V3_Malloc(sizeof(struct swapbypass_local_state));
 
+    if (!swapbypass_state) {
+       PrintError("Cannot allocate\n");
+       return -1;
+    }
+
+
     INIT_LIST_HEAD(&(swapbypass_state->page_list));
 
     state->local_impl_data = swapbypass_state;