slirp: check len against dhcp options array end
[qemu/ar7.git] / tests / libqos / malloc-generic.c
blob33ce90b925a368a222778c98b76e3987fcac13df
1 /*
2 * Basic libqos generic malloc support
4 * Copyright (c) 2014 Marc MarĂ­
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #include "qemu/osdep.h"
11 #include "libqos/malloc-generic.h"
12 #include "libqos/malloc.h"
15 * Mostly for valgrind happiness, but it does offer
16 * a chokepoint for debugging guest memory leaks, too.
18 void generic_alloc_uninit(QGuestAllocator *allocator)
20 alloc_uninit(allocator);
23 QGuestAllocator *generic_alloc_init_flags(uint64_t base_addr, uint64_t size,
24 uint32_t page_size, QAllocOpts flags)
26 QGuestAllocator *s;
27 uint64_t start = base_addr + (1 << 20); /* Start at 1MB */
29 s = alloc_init_flags(flags, start, start + size);
30 alloc_set_page_size(s, page_size);
32 return s;
35 inline QGuestAllocator *generic_alloc_init(uint64_t base_addr, uint64_t size,
36 uint32_t page_size)
38 return generic_alloc_init_flags(base_addr, size, page_size, ALLOC_NO_FLAGS);