vfs: check userland buffers before reading them.
[haiku.git] / src / system / kernel / vm / VMKernelArea.cpp
blob37f84aada589ffae4439e07c37f63293bfb9e005
1 /*
2 * Copyright 2009-2011, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the NewOS License.
4 */
7 #include "VMKernelArea.h"
9 #include <heap.h>
10 #include <slab/Slab.h>
11 #include <vm/vm_priv.h>
14 VMKernelArea::VMKernelArea(VMAddressSpace* addressSpace, uint32 wiring,
15 uint32 protection)
17 VMArea(addressSpace, wiring, protection)
22 VMKernelArea::~VMKernelArea()
27 /*static*/ VMKernelArea*
28 VMKernelArea::Create(VMAddressSpace* addressSpace, const char* name,
29 uint32 wiring, uint32 protection, ObjectCache* objectCache,
30 uint32 allocationFlags)
32 VMKernelArea* area = new(objectCache, allocationFlags) VMKernelArea(
33 addressSpace, wiring, protection);
34 if (area == NULL)
35 return NULL;
37 if (area->Init(name, allocationFlags) != B_OK) {
38 object_cache_delete(objectCache, area);
39 return NULL;
42 return area;