VirtualBox

Ignore:
Timestamp:
Mar 20, 2009 9:17:53 PM (16 years ago)
Author:
vboxsync
Message:

Additions/Linux/vboxadd: use RTMemAlloc instead of kmalloc for allocating bounce buffers for HGCM, to better cope with large buffers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/linux/module/vboxmod.c

    r17962 r18124  
    7171#include <iprt/asm.h>
    7272#include <iprt/assert.h>
     73#include <iprt/mem.h>
    7374#include <iprt/memobj.h>
    7475#include <linux/miscdevice.h>
     
    415416    AssertPtrReturn(pUser, -EINVAL);
    416417
    417     pBuf = kmalloc(sizeof(*pBuf), GFP_KERNEL);
     418    pBuf = RTMemAlloc(sizeof(*pBuf));
    418419    if (pBuf == NULL)
    419420        rc = -ENOMEM;
    420421    if (rc >= 0)
    421422    {
    422         pKernel = kmalloc(cb, GFP_KERNEL);
     423        pKernel = RTMemAlloc(cb);
    423424        if (pKernel == NULL)
    424425            rc = -ENOMEM;
     
    437438    else
    438439    {
    439         kfree(pBuf);
    440         kfree(pKernel);
     440        RTMemFree(pBuf);
     441        RTMemFree(pKernel);
    441442        LogFunc(("failed, returning %d\n", rc));
    442443    }
     
    451452    if (copy && copy_to_user(pBuf->pUser, pBuf->pKernel, pBuf->cb) != 0)
    452453        rc = -EFAULT;
    453     kfree(pBuf->pKernel);  /* We want to do this whatever the outcome. */
    454     kfree(pBuf);
     454    RTMemFree(pBuf->pKernel);  /* We want to do this whatever the outcome. */
     455    RTMemFree(pBuf);
    455456    if (rc < 0)
    456457        LogFunc(("failed, returning %d\n", rc));
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