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
// 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);
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;