Changeset 4824 in vbox for trunk/src/VBox/HostDrivers
- Timestamp:
- Sep 15, 2007 12:29:02 PM (17 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h
r4811 r4824 52 52 # include <sys/ioccom.h> 53 53 # define SUP_CTL_CODE_SIZE(Function, Size) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR)) 54 # define SUP_CTL_CODE_BIG(Function) _IO ( 'V', (Function) | SUP_IOCTL_FLAG)54 # define SUP_CTL_CODE_BIG(Function) _IOWRN('V', (Function) | SUP_IOCTL_FLAG, sizeof(SUPREQHDR)) 55 55 # define SUP_CTL_CODE_FAST(Function) _IO( 'V', (Function) | SUP_IOCTL_FLAG) 56 56 # define SUP_CTL_CODE_NO_SIZE(uIOCtl) (uIOCtl) -
trunk/src/VBox/HostDrivers/Support/solaris/SUPDrv-solaris.c
r4811 r4824 494 494 } 495 495 496 497 /** @def IOCPARM_LEN 498 * Gets the length from the ioctl number. 499 * This is normally defined by sys/ioccom.h on BSD systems... 500 */ 501 #ifndef IOCPARM_LEN 502 # define IOCPARM_LEN(x) ( ((x) >> 16) & IOCPARM_MASK ) 503 #endif 504 505 496 506 /** 497 507 * Worker for VBoxSupDrvIOCtl that takes the slow IOCtl functions. … … 515 525 * Read the header. 516 526 */ 527 if (RT_UNLIKELY(IOC_PARMLEN(iCmd) != sizeof(Hdr))) 528 { 529 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: iCmd=%#x len %d expected %d\n", iCmd, IOC_PARMLEN(iCmd), sizeof(Hdr))); 530 return EINVAL; 531 } 517 532 rc = ddi_copyin(&Hdr, (void *)iArg, sizeof(Hdr), Mode); 518 533 if (RT_UNLIKELY(rc)) 519 534 { 520 dprintf(("VBoxDrvSolarisIOCtlSlow: ddi_copyin(,%#lx,) failed; iCmd=%#x. rc=%d\n", iArg, iCmd, rc));535 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: ddi_copyin(,%#lx,) failed; iCmd=%#x. rc=%d\n", iArg, iCmd, rc)); 521 536 return EFAULT; 522 537 } 523 538 if (RT_UNLIKELY((Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK) != SUPREQHDR_FLAGS_MAGIC)) 524 539 { 525 dprintf(("VBoxDrvSolarisIOCtlSlow: bad header magic %#x; iCmd=%#x\n", Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK, iCmd));540 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: bad header magic %#x; iCmd=%#x\n", Hdr.fFlags & SUPREQHDR_FLAGS_MAGIC_MASK, iCmd)); 526 541 return EINVAL; 527 542 } 543 cbBuf = RT_MAX(Hdr.cbIn, Hdr.cbOut); 544 if (RT_UNLIKELY( Hdr.cbIn < sizeof(Hdr) 545 || Hdr.cbOut < sizeof(Hdr) 546 || cbReq > _1M*16)) 547 { 548 OSDBGPRINT(("VBoxDrvSolarisIOCtlSlow: max(%#x,%#x); iCmd=%#x\n", Hdr.cbIn, Hdr.cbOut, iCmd)); 549 return EINVAL; 550 } 528 551 529 552 /* 530 553 * Buffer the request. 531 554 */ 532 cbBuf = RT_MAX(Hdr.cbIn, Hdr.cbOut); 533 if (RT_UNLIKELY(cbBuf > _1M*16)) 534 { 535 dprintf(("VBoxDrvSolarisIOCtlSlow: too big cbBuf=%#x; iCmd=%#x\n", cbBuf, iCmd)); 536 return E2BIG; 537 } 538 if (RT_UNLIKELY(cbBuf < sizeof(Hdr))) 539 { 540 dprintf(("VBoxDrvSolarisIOCtlSlow: bad ioctl cbBuf=%#x; iCmd=%#x.\n", cbBuf, iCmd)); 541 return EINVAL; 542 } 543 pHdr = RTMemAlloc(cbBuf); 555 pHdr = RTMemTmpAlloc(cbBuf); 544 556 if (RT_UNLIKELY(!pHdr)) 545 557 {
Note:
See TracChangeset
for help on using the changeset viewer.