VirtualBox

Ignore:
Timestamp:
Jul 31, 2021 12:44:13 AM (3 years ago)
Author:
vboxsync
Message:

Dev*: Checked up all the PDMDevHlpCritSectEnter calls to make sure the status code is checked. bugref:6695

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DevVirtioNet.cpp

    r90156 r90447  
    328328    return !!(pThis->VPCI.uGuestFeatures & VNET_F_MRG_RXBUF);
    329329}
     330
     331#define VNET_R3_CS_ENTER_RETURN_VOID(a_pDevIns, a_pThis) VPCI_R3_CS_ENTER_RETURN_VOID(a_pDevIns, &(a_pThis)->VPCI)
    330332
    331333DECLINLINE(int) vnetR3CsEnter(PPDMDEVINS pDevIns, PVNETSTATE pThis, int rcBusy)
     
    648650    RT_NOREF(hTimer, pvUser);
    649651
    650     int rc = vnetR3CsEnter(pDevIns, pThis, VERR_SEM_BUSY);
    651     AssertRCReturnVoid(rc);
     652    VNET_R3_CS_ENTER_RETURN_VOID(pDevIns, pThis);
    652653
    653654    pThis->config.uStatus |= VNET_S_LINK_UP;
     
    15091510        Log3(("%s vnetR3QueueTransmit: Got kicked with notification disabled, re-enable notification and flush TX queue\n", INSTANCE(pThis)));
    15101511        vnetR3TransmitPendingPackets(pDevIns, pThis, pThisCC, pQueue, false /*fOnWorkerThread*/);
    1511         if (RT_FAILURE(vnetR3CsEnter(pDevIns, pThis, VERR_SEM_BUSY)))
    1512             LogRel(("vnetR3QueueTransmit: Failed to enter critical section!/n"));
    1513         else
    1514         {
    1515             vringSetNotification(pDevIns, &pThisCC->pTxQueue->VRing, true);
    1516             vnetR3CsLeave(pDevIns, pThis);
    1517         }
     1512
     1513        VNET_R3_CS_ENTER_RETURN_VOID(pDevIns, pThis);
     1514
     1515        vringSetNotification(pDevIns, &pThisCC->pTxQueue->VRing, true);
     1516
     1517        vnetR3CsLeave(pDevIns, pThis);
    15181518    }
    15191519    else
    15201520    {
    1521         if (RT_FAILURE(vnetR3CsEnter(pDevIns, pThis, VERR_SEM_BUSY)))
    1522             LogRel(("vnetR3QueueTransmit: Failed to enter critical section!/n"));
    1523         else
    1524         {
    1525             vringSetNotification(pDevIns, &pThisCC->pTxQueue->VRing, false);
    1526             PDMDevHlpTimerSetMicro(pDevIns, pThis->hTxTimer, VNET_TX_DELAY);
    1527             pThis->u64NanoTS = RTTimeNanoTS();
    1528             vnetR3CsLeave(pDevIns, pThis);
    1529         }
     1521        VNET_R3_CS_ENTER_RETURN_VOID(pDevIns, pThis);
     1522
     1523        vringSetNotification(pDevIns, &pThisCC->pTxQueue->VRing, false);
     1524        PDMDevHlpTimerSetMicro(pDevIns, pThis->hTxTimer, VNET_TX_DELAY);
     1525        pThis->u64NanoTS = RTTimeNanoTS();
     1526
     1527        vnetR3CsLeave(pDevIns, pThis);
    15301528    }
    15311529}
     
    15521550//    Log3(("%s vnetR3TxTimer: Expired\n", INSTANCE(pThis)));
    15531551    vnetR3TransmitPendingPackets(pDevIns, pThis, pThisCC, pThisCC->pTxQueue, false /*fOnWorkerThread*/);
    1554     int rc = vnetR3CsEnter(pDevIns, pThis, VERR_SEM_BUSY)
    1555     AssertLogRelRCReturnVoid(rc);
     1552
     1553    VNET_R3_CS_ENTER_RETURN_VOID(pDevIns, pThis);
    15561554    vringSetNotification(pDevIns, &pThisCC->pTxQueue->VRing, true);
    15571555    vnetR3CsLeave(pDevIns, pThis);
     
    20432041    AssertLogRelReturnVoid(iLUN == 0);
    20442042
    2045     int rc = vnetR3CsEnter(pDevIns, pThis, VERR_SEM_BUSY);
    2046     if (RT_FAILURE(rc))
    2047     {
    2048         LogRel(("vnetR3Detach failed to enter critical section!\n"));
    2049         return;
    2050     }
     2043    VNET_R3_CS_ENTER_RETURN_VOID(pDevIns, pThis);
    20512044
    20522045    vnetR3DestroyTxThreadAndEvent(pDevIns, pThis, pThisCC);
     
    20752068
    20762069    int rc = vnetR3CsEnter(pDevIns, pThis, VERR_SEM_BUSY);
    2077     if (RT_FAILURE(rc))
    2078     {
    2079         LogRel(("vnetR3Attach failed to enter critical section!\n"));
    2080         return rc;
    2081     }
     2070    AssertRCReturn(rc, rc);
    20822071
    20832072    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette