From: Peter Dinda Date: Wed, 1 Jul 2015 22:38:56 +0000 (-0500) Subject: Cleanup based on cppcheck pass (Devices and Extensions) X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=2282a040e60b24d3fb7c48bb197c5bff6636df67;p=palacios.git Cleanup based on cppcheck pass (Devices and Extensions) --- diff --git a/palacios/src/devices/8237_dma.c b/palacios/src/devices/8237_dma.c index adb5b4b..f131138 100644 --- a/palacios/src/devices/8237_dma.c +++ b/palacios/src/devices/8237_dma.c @@ -52,5 +52,5 @@ struct vm_device * v3_create_dma() { struct vm_device * dev = v3_create_device("DMA", &dev_ops, dma); - return dma; + return dev; } diff --git a/palacios/src/devices/i440fx.c b/palacios/src/devices/i440fx.c index a68e275..510d08a 100644 --- a/palacios/src/devices/i440fx.c +++ b/palacios/src/devices/i440fx.c @@ -99,13 +99,11 @@ static int i440_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { ret |= v3_dev_hook_io(dev, 0x0cfc + i, &io_read, &io_write); } - /* if (ret != 0) { PrintError(vm, VCORE_NONE, "Error hooking i440FX io ports\n"); - v3_remove_device(dev); - return -1; + //v3_remove_device(dev); + //return -1; } - */ for (i = 0; i < 6; i++) { bars[i].type = PCI_BAR_NONE; diff --git a/palacios/src/devices/ide.c b/palacios/src/devices/ide.c index 45aaba7..bf842e9 100644 --- a/palacios/src/devices/ide.c +++ b/palacios/src/devices/ide.c @@ -507,7 +507,11 @@ static int dma_read(struct guest_info * core, struct ide_internal * ide, struct cmd_ret = v3_write_gpa_memory(core, prd_entry.base_addr + prd_offset, bytes_to_write, drive->data_buf); - // check cmd_ret + if (cmd_ret!=bytes_to_write) { + PrintError(core->vm_info, core, "Failed to write data to memory\n"); + return -1; + } + bytes_to_write = 0; diff --git a/palacios/src/devices/lnx_virtio_sym.c b/palacios/src/devices/lnx_virtio_sym.c index 3fbeffe..654b201 100644 --- a/palacios/src/devices/lnx_virtio_sym.c +++ b/palacios/src/devices/lnx_virtio_sym.c @@ -48,7 +48,7 @@ struct virtio_sym_state { struct vm_device * pci_bus; struct pci_device * pci_dev; - struct virtio_queue queue[1]; + struct virtio_queue queue[2]; struct virtio_queue * cur_queue; diff --git a/palacios/src/devices/rtl8139.c b/palacios/src/devices/rtl8139.c index aadfcea..9d4e7c7 100644 --- a/palacios/src/devices/rtl8139.c +++ b/palacios/src/devices/rtl8139.c @@ -956,6 +956,8 @@ static int rx_one_pkt(struct rtl8139_state * nic_state, uint32_t header, val; uint8_t bcast_addr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; + header = 0; + if (regs->rcr & AcceptAllPhys) { PrintDebug(VM_NONE, VCORE_NONE, "RTL8139: packet received in promiscuous mode\n"); } else { diff --git a/palacios/src/extensions/ext_sched_edf.c b/palacios/src/extensions/ext_sched_edf.c index 7694e3c..7b7c108 100644 --- a/palacios/src/extensions/ext_sched_edf.c +++ b/palacios/src/extensions/ext_sched_edf.c @@ -595,7 +595,7 @@ delete_core_edf( struct vm_core_edf_sched *core_edf , struct vm_edf_rq *runqueu return true; } else{ - PrintError(core->info->vm_info, core->info,"EDF Sched. delete_core_edf.Attempted to erase unexisting core"); + PrintError(VM_NONE,VCORE_NONE,"EDF Sched. delete_core_edf.Attempted to erase unexisting core"); return false; } } diff --git a/palacios/src/extensions/ext_trans_mem.c b/palacios/src/extensions/ext_trans_mem.c index 7a4c838..7fb8164 100644 --- a/palacios/src/extensions/ext_trans_mem.c +++ b/palacios/src/extensions/ext_trans_mem.c @@ -1742,9 +1742,7 @@ deinit_trans_mem_core (struct guest_info * core, v3_lock_deinit(&(tm->addr_ctxt_lock)); v3_lock_deinit(&(tm->access_type_lock)); - if (tm) { - V3_Free(tm); - } + V3_Free(tm); return 0; }