VirtualBox

Changeset 85944 in vbox


Ignore:
Timestamp:
Aug 28, 2020 8:57:37 PM (4 years ago)
Author:
vboxsync
Message:

Storage/VD.cpp: Remove duplicate argument validation in VDCreateBase and addressed a couple of todos. bugref:9224

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Storage/VD.cpp

    r85941 r85944  
    62206220                 uOpenFlags, pVDIfsImage, pVDIfsOperation));
    62216221
     6222    AssertPtrReturn(pVDIfsOperation, VERR_INVALID_PARAMETER);
    62226223    PVDINTERFACEPROGRESS pIfProgress = VDIfProgressGet(pVDIfsOperation);
    62236224
    62246225    do
    62256226    {
     6227        /** @todo r=bird: there is no particular reason why this validation has to be
     6228         *        done inside the do-break-while-goto-is-false loop.  (pIfProgress is
     6229         *        only called on success.)  Could just AssertMsgReturn, rather than
     6230         *        complicated AssertMsgBreakStmt. */
    62266231        /* sanity check */
    62276232        AssertPtrBreakStmt(pDisk, rc = VERR_INVALID_PARAMETER);
    6228         AssertPtrBreakStmt(pszBackend, rc = VERR_INVALID_PARAMETER);
    6229         AssertPtrBreakStmt(pszFilename, rc = VERR_INVALID_PARAMETER);
    6230         AssertPtrBreakStmt(pPCHSGeometry, rc = VERR_INVALID_PARAMETER);
    6231         AssertPtrBreakStmt(pLCHSGeometry, rc = VERR_INVALID_PARAMETER);
    6232         AssertPtrBreakStmt(pUuid, rc = VERR_INVALID_PARAMETER);
    6233         AssertPtrBreakStmt(pVDIfsImage, rc = VERR_INVALID_PARAMETER);
    6234         AssertPtrBreakStmt(pVDIfsOperation, rc = VERR_INVALID_PARAMETER);
    6235 
    6236         AssertMsg(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature));
     6233        AssertMsgBreakStmt(pDisk->u32Signature == VDISK_SIGNATURE, ("u32Signature=%08x\n", pDisk->u32Signature),
     6234                           rc = VERR_INVALID_MAGIC);
    62376235
    62386236        /* Check arguments. */
     
    62616259                           rc = VERR_INVALID_PARAMETER);
    62626260        /* The PCHS geometry fields may be 0 to leave it for later. */
    6263         AssertMsgBreakStmt(   VALID_PTR(pPCHSGeometry) /** @todo r=bird: will crash in assert message formatting if invalid. duh. */
    6264                            && pPCHSGeometry->cHeads <= 16
     6261        AssertPtrBreakStmt(pPCHSGeometry, rc = VERR_INVALID_PARAMETER);
     6262        AssertMsgBreakStmt(  pPCHSGeometry->cHeads <= 16
    62656263                           && pPCHSGeometry->cSectors <= 63,
    6266                            ("pPCHSGeometry=%#p PCHS=%u/%u/%u\n", pPCHSGeometry,
    6267                             pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads,
    6268                             pPCHSGeometry->cSectors),
     6264                           ("PCHS=%u/%u/%u\n", pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors),
    62696265                           rc = VERR_INVALID_PARAMETER);
    62706266        /* The LCHS geometry fields may be 0 to leave it to later autodetection. */
    6271         AssertMsgBreakStmt(   VALID_PTR(pLCHSGeometry) /** @todo r=bird: will crash in assert message formatting if invalid. duh. */
    6272                            && pLCHSGeometry->cHeads <= 255
     6267        AssertPtrBreakStmt(pLCHSGeometry, rc = VERR_INVALID_PARAMETER);
     6268        AssertMsgBreakStmt(  pLCHSGeometry->cHeads <= 255
    62736269                           && pLCHSGeometry->cSectors <= 63,
    6274                            ("pLCHSGeometry=%#p LCHS=%u/%u/%u\n", pLCHSGeometry,
    6275                             pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads,
    6276                             pLCHSGeometry->cSectors),
     6270                           ("LCHS=%u/%u/%u\n", pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors),
    62776271                           rc = VERR_INVALID_PARAMETER);
    62786272        /* The UUID may be NULL. */
     
    62836277                           ("uOpenFlags=%#x\n", uOpenFlags),
    62846278                           rc = VERR_INVALID_PARAMETER);
     6279
     6280        AssertPtrBreakStmt(pVDIfsImage, rc = VERR_INVALID_PARAMETER);
    62856281
    62866282        /* Check state. Needs a temporary read lock. Holding the write lock
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