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.


Cleanup and sanity-checking of endianness, dead code, unchecked returns (Coverity...
[palacios.git] / palacios / src / devices / rtl8139.c
index 9d4e7c7..e8e10e3 100644 (file)
@@ -895,7 +895,10 @@ static void rtl8139_rxbuf_write(struct rtl8139_state * nic_state,
     addr_t guestpa, host_rxbuf;
 
     guestpa = (addr_t)regs->rbstart;
-    v3_gpa_to_hva(&(nic_state->vm->cores[0]), guestpa, &host_rxbuf);   
+    if (v3_gpa_to_hva(&(nic_state->vm->cores[0]), guestpa, &host_rxbuf)) { 
+       PrintError(VM_NONE, VCORE_NONE, "RTL8139: cannot translate address\n");
+       return;
+    }
 
     //wrap to the front of rx buffer
     if (regs->cbr + size > nic_state->rx_bufsize){
@@ -1173,7 +1176,11 @@ static int tx_one_packet(struct rtl8139_state * nic_state, int descriptor){
 
     PrintDebug(VM_NONE, VCORE_NONE, "RTL8139: sending %d bytes from guest memory at 0x%08x\n", txsize, regs->tsad[descriptor]);
        
-    v3_gpa_to_hva(&(nic_state->vm->cores[0]), (addr_t)pkt_gpa, &hostva);
+    if (v3_gpa_to_hva(&(nic_state->vm->cores[0]), (addr_t)pkt_gpa, &hostva)) {     
+       PrintError(VM_NONE, VCORE_NONE, "RTL8139: Cannot translate address\n");
+       return -1;
+    }
+
     pkt = (uchar_t *)hostva;
 
 #ifdef V3_CONFIG_DEBUG_RTL8139