addr_t pkt_gpa = info->vm_regs.rbx;
int pkt_len = info->vm_regs.rcx;
uchar_t * pkt = V3_Malloc(pkt_len);
+
+ if (!pkt) {
+ PrintError("Cannot allocate in transmit!\n");
+ return -1;
+ }
PrintDebug("Transmitting Packet\n");
static int net_init(struct guest_info * vm, v3_cfg_tree_t * cfg) {
struct nic_state * state = NULL;
- char * name = v3_cfg_val(cfg, "name");
+ char * dev_id = v3_cfg_val(cfg, "ID");
state = (struct nic_state *)V3_Malloc(sizeof(struct nic_state));
+ if (!state) {
+ PrintError("Cannot allocate in init\n");
+ return -1;
+ }
+
PrintDebug("Creating VMNet Device\n");
- struct vm_device * dev = v3_allocate_device(name, &dev_ops, state);
+ struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, state);
if (v3_attach_device(vm, dev) == -1) {
- PrintError("Could not attach device %s\n", name);
+ PrintError("Could not attach device %s\n", dev_id);
return -1;
}