VirtualBox

Changeset 24282 in vbox


Ignore:
Timestamp:
Nov 3, 2009 10:14:35 AM (15 years ago)
Author:
vboxsync
Message:

PDM: Added missing driver instance checks.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r24272 r24282  
    10821082/** Too many instances of a device. */
    10831083#define VERR_PDM_TOO_MANY_DEVICE_INSTANCES          (-2867)
     1084/** Too many instances of a driver. */
     1085#define VERR_PDM_TOO_MANY_DRIVER_INSTANCES          (-2868)
     1086/** Too many instances of a usb device. */
     1087#define VERR_PDM_TOO_MANY_USB_DEVICE_INSTANCES      (-2869)
    10841088/** @} */
    10851089
  • trunk/src/VBox/VMM/PDMDevHlp.cpp

    r24141 r24282  
    847847     */
    848848    int rc;
    849     char szNode[48];
    850     RTStrPrintf(szNode, sizeof(szNode), "LUN#%d", iLun);
    851     PCFGMNODE   pNode = CFGMR3GetChild(pDevIns->Internal.s.pCfgHandle, szNode);
     849    PCFGMNODE pNode = CFGMR3GetChildF(pDevIns->Internal.s.pCfgHandle, "LUN#%u", iLun);
    852850    if (pNode)
    853851    {
     
    860858             */
    861859            PPDMDRV pDrv = pdmR3DrvLookup(pVM, pszName);
    862             if (pDrv)
     860            if (    pDrv
     861                &&  pDrv->cInstances < pDrv->pDrvReg->cMaxInstances)
    863862            {
    864863                /* config node */
     
    930929                else
    931930                    AssertMsgFailed(("Failed to create Config node! rc=%Rrc\n", rc));
     931            }
     932            else if (pDrv)
     933            {
     934                AssertMsgFailed(("Too many instances of driver '%s', max is %u\n", pszName, pDrv->pDrvReg->cMaxInstances));
     935                rc = VERR_PDM_TOO_MANY_DRIVER_INSTANCES;
    932936            }
    933937            else
  • trunk/src/VBox/VMM/PDMDriver.cpp

    r23915 r24282  
    510510                PVM pVM = pDrvIns->Internal.s.pVM;
    511511                PPDMDRV pDrv = pdmR3DrvLookup(pVM, pszName);
    512                 if (pDrv)
     512                if (    pDrv
     513                    &&  pDrv->cInstances < pDrv->pDrvReg->cMaxInstances)
    513514                {
    514515                    /* config node */
     
    579580                    else
    580581                        AssertMsgFailed(("Failed to create Config node! rc=%Rrc\n", rc));
     582                }
     583                else if (pDrv)
     584                {
     585                    AssertMsgFailed(("Too many instances of driver '%s', max is %u\n", pszName, pDrv->pDrvReg->cMaxInstances));
     586                    rc = VERR_PDM_TOO_MANY_DRIVER_INSTANCES;
    581587                }
    582588                else
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