Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/include/xen/xmalloc.h
Line
Count
Source (jump to first uncovered line)
1
2
#ifndef __XMALLOC_H__
3
#define __XMALLOC_H__
4
5
#include <xen/types.h>
6
#include <xen/cache.h>
7
8
/*
9
 * Xen malloc/free-style interface.
10
 */
11
12
/* Allocate space for typed object. */
13
902
#define xmalloc(_type) ((_type *)_xmalloc(sizeof(_type), __alignof__(_type)))
14
261
#define xzalloc(_type) ((_type *)_xzalloc(sizeof(_type), __alignof__(_type)))
15
16
/* Allocate space for array of typed objects. */
17
#define xmalloc_array(_type, _num) \
18
66
    ((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num))
19
#define xzalloc_array(_type, _num) \
20
97
    ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num))
21
22
/* Allocate untyped storage. */
23
3
#define xmalloc_bytes(_bytes) _xmalloc(_bytes, SMP_CACHE_BYTES)
24
54
#define xzalloc_bytes(_bytes) _xzalloc(_bytes, SMP_CACHE_BYTES)
25
26
/* Free any of the above. */
27
extern void xfree(void *);
28
29
/* Underlying functions */
30
extern void *_xmalloc(unsigned long size, unsigned long align);
31
extern void *_xzalloc(unsigned long size, unsigned long align);
32
33
static inline void *_xmalloc_array(
34
    unsigned long size, unsigned long align, unsigned long num)
35
66
{
36
66
    /* Check for overflow. */
37
66
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
66
    return _xmalloc(size * num, align);
40
66
}
Unexecuted instantiation: stub.c:_xmalloc_array
Unexecuted instantiation: bitmap.c:_xmalloc_array
Unexecuted instantiation: bsearch.c:_xmalloc_array
Unexecuted instantiation: core_parking.c:_xmalloc_array
Unexecuted instantiation: cpu.c:_xmalloc_array
Unexecuted instantiation: cpupool.c:_xmalloc_array
Unexecuted instantiation: domctl.c:_xmalloc_array
Unexecuted instantiation: domain.c:_xmalloc_array
Unexecuted instantiation: event_2l.c:_xmalloc_array
Unexecuted instantiation: event_channel.c:_xmalloc_array
Unexecuted instantiation: event_fifo.c:_xmalloc_array
Unexecuted instantiation: grant_table.c:_xmalloc_array
Unexecuted instantiation: guestcopy.c:_xmalloc_array
Unexecuted instantiation: irq.c:_xmalloc_array
Unexecuted instantiation: kernel.c:_xmalloc_array
Unexecuted instantiation: keyhandler.c:_xmalloc_array
Unexecuted instantiation: kexec.c:_xmalloc_array
Unexecuted instantiation: kimage.c:_xmalloc_array
Unexecuted instantiation: lib.c:_xmalloc_array
Unexecuted instantiation: lzo.c:_xmalloc_array
Unexecuted instantiation: mem_access.c:_xmalloc_array
Unexecuted instantiation: memory.c:_xmalloc_array
Unexecuted instantiation: monitor.c:_xmalloc_array
Unexecuted instantiation: multicall.c:_xmalloc_array
Unexecuted instantiation: notifier.c:_xmalloc_array
Unexecuted instantiation: page_alloc.c:_xmalloc_array
Unexecuted instantiation: pdx.c:_xmalloc_array
Unexecuted instantiation: preempt.c:_xmalloc_array
Unexecuted instantiation: random.c:_xmalloc_array
Unexecuted instantiation: rangeset.c:_xmalloc_array
Unexecuted instantiation: radix-tree.c:_xmalloc_array
Unexecuted instantiation: rcupdate.c:_xmalloc_array
Unexecuted instantiation: rwlock.c:_xmalloc_array
Unexecuted instantiation: sched_arinc653.c:_xmalloc_array
Unexecuted instantiation: sched_credit.c:_xmalloc_array
Unexecuted instantiation: sched_credit2.c:_xmalloc_array
Unexecuted instantiation: sched_rt.c:_xmalloc_array
Unexecuted instantiation: sched_null.c:_xmalloc_array
Unexecuted instantiation: schedule.c:_xmalloc_array
Unexecuted instantiation: shutdown.c:_xmalloc_array
Unexecuted instantiation: softirq.c:_xmalloc_array
Unexecuted instantiation: smp.c:_xmalloc_array
Unexecuted instantiation: spinlock.c:_xmalloc_array
Unexecuted instantiation: stop_machine.c:_xmalloc_array
Unexecuted instantiation: symbols.c:_xmalloc_array
Unexecuted instantiation: sysctl.c:_xmalloc_array
Unexecuted instantiation: tasklet.c:_xmalloc_array
Unexecuted instantiation: time.c:_xmalloc_array
timer.c:_xmalloc_array
Line
Count
Source
35
12
{
36
12
    /* Check for overflow. */
37
12
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
12
    return _xmalloc(size * num, align);
40
12
}
Unexecuted instantiation: trace.c:_xmalloc_array
Unexecuted instantiation: version.c:_xmalloc_array
Unexecuted instantiation: virtual_region.c:_xmalloc_array
Unexecuted instantiation: vm_event.c:_xmalloc_array
vmap.c:_xmalloc_array
Line
Count
Source
35
1
{
36
1
    /* Check for overflow. */
37
1
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
1
    return _xmalloc(size * num, align);
40
1
}
Unexecuted instantiation: vsprintf.c:_xmalloc_array
Unexecuted instantiation: wait.c:_xmalloc_array
Unexecuted instantiation: xenoprof.c:_xmalloc_array
Unexecuted instantiation: xmalloc_tlsf.c:_xmalloc_array
Unexecuted instantiation: xlat.c:_xmalloc_array
Unexecuted instantiation: tmem.c:_xmalloc_array
Unexecuted instantiation: tmem_xen.c:_xmalloc_array
Unexecuted instantiation: tmem_control.c:_xmalloc_array
Unexecuted instantiation: llvm.c:_xmalloc_array
Unexecuted instantiation: libelf-tools.c:_xmalloc_array
Unexecuted instantiation: libelf-loader.c:_xmalloc_array
Unexecuted instantiation: libelf-dominfo.c:_xmalloc_array
Unexecuted instantiation: console.c:_xmalloc_array
Unexecuted instantiation: ns16550.c:_xmalloc_array
Unexecuted instantiation: ehci-dbgp.c:_xmalloc_array
Unexecuted instantiation: serial.c:_xmalloc_array
Unexecuted instantiation: cpufreq.c:_xmalloc_array
Unexecuted instantiation: cpufreq_ondemand.c:_xmalloc_array
Unexecuted instantiation: cpufreq_misc_governors.c:_xmalloc_array
Unexecuted instantiation: utility.c:_xmalloc_array
Unexecuted instantiation: pci.c:_xmalloc_array
Unexecuted instantiation: vpci.c:_xmalloc_array
Unexecuted instantiation: header.c:_xmalloc_array
msi.c:_xmalloc_array
Line
Count
Source
35
42
{
36
42
    /* Check for overflow. */
37
42
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
42
    return _xmalloc(size * num, align);
40
42
}
Unexecuted instantiation: msix.c:_xmalloc_array
Unexecuted instantiation: iommu.c:_xmalloc_array
Unexecuted instantiation: io.c:_xmalloc_array
Unexecuted instantiation: dmar.c:_xmalloc_array
Unexecuted instantiation: utils.c:_xmalloc_array
Unexecuted instantiation: qinval.c:_xmalloc_array
intremap.c:_xmalloc_array
Line
Count
Source
35
2
{
36
2
    /* Check for overflow. */
37
2
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
2
    return _xmalloc(size * num, align);
40
2
}
Unexecuted instantiation: quirks.c:_xmalloc_array
Unexecuted instantiation: vtd.c:_xmalloc_array
Unexecuted instantiation: ats.c:_xmalloc_array
Unexecuted instantiation: iommu_init.c:_xmalloc_array
Unexecuted instantiation: iommu_map.c:_xmalloc_array
Unexecuted instantiation: pci_amd_iommu.c:_xmalloc_array
Unexecuted instantiation: iommu_intr.c:_xmalloc_array
Unexecuted instantiation: iommu_cmd.c:_xmalloc_array
Unexecuted instantiation: iommu_guest.c:_xmalloc_array
Unexecuted instantiation: numa.c:_xmalloc_array
Unexecuted instantiation: osl.c:_xmalloc_array
Unexecuted instantiation: pmstat.c:_xmalloc_array
Unexecuted instantiation: hwregs.c:_xmalloc_array
Unexecuted instantiation: reboot.c:_xmalloc_array
Unexecuted instantiation: tbutils.c:_xmalloc_array
Unexecuted instantiation: utglobal.c:_xmalloc_array
Unexecuted instantiation: erst.c:_xmalloc_array
Unexecuted instantiation: hest.c:_xmalloc_array
Unexecuted instantiation: apei-base.c:_xmalloc_array
Unexecuted instantiation: apei-io.c:_xmalloc_array
Unexecuted instantiation: vga.c:_xmalloc_array
Unexecuted instantiation: lfb.c:_xmalloc_array
Unexecuted instantiation: vesa.c:_xmalloc_array
Unexecuted instantiation: xsm_core.c:_xmalloc_array
Unexecuted instantiation: apic.c:_xmalloc_array
Unexecuted instantiation: bitops.c:_xmalloc_array
Unexecuted instantiation: cpuid.c:_xmalloc_array
Unexecuted instantiation: compat.c:_xmalloc_array
Unexecuted instantiation: crash.c:_xmalloc_array
Unexecuted instantiation: debug.c:_xmalloc_array
Unexecuted instantiation: delay.c:_xmalloc_array
Unexecuted instantiation: domain_page.c:_xmalloc_array
Unexecuted instantiation: e820.c:_xmalloc_array
Unexecuted instantiation: extable.c:_xmalloc_array
Unexecuted instantiation: flushtlb.c:_xmalloc_array
Unexecuted instantiation: hypercall.c:_xmalloc_array
Unexecuted instantiation: i387.c:_xmalloc_array
Unexecuted instantiation: i8259.c:_xmalloc_array
io_apic.c:_xmalloc_array
Line
Count
Source
35
3
{
36
3
    /* Check for overflow. */
37
3
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
3
    return _xmalloc(size * num, align);
40
3
}
Unexecuted instantiation: msr.c:_xmalloc_array
Unexecuted instantiation: ioport_emulate.c:_xmalloc_array
Unexecuted instantiation: machine_kexec.c:_xmalloc_array
Unexecuted instantiation: microcode_amd.c:_xmalloc_array
Unexecuted instantiation: microcode_intel.c:_xmalloc_array
Unexecuted instantiation: microcode.c:_xmalloc_array
Unexecuted instantiation: mm.c:_xmalloc_array
Unexecuted instantiation: mpparse.c:_xmalloc_array
Unexecuted instantiation: nmi.c:_xmalloc_array
Unexecuted instantiation: percpu.c:_xmalloc_array
Unexecuted instantiation: physdev.c:_xmalloc_array
Unexecuted instantiation: platform_hypercall.c:_xmalloc_array
Unexecuted instantiation: psr.c:_xmalloc_array
setup.c:_xmalloc_array
Line
Count
Source
35
1
{
36
1
    /* Check for overflow. */
37
1
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
1
    return _xmalloc(size * num, align);
40
1
}
Unexecuted instantiation: smpboot.c:_xmalloc_array
Unexecuted instantiation: srat.c:_xmalloc_array
Unexecuted instantiation: string.c:_xmalloc_array
Unexecuted instantiation: traps.c:_xmalloc_array
Unexecuted instantiation: usercopy.c:_xmalloc_array
Unexecuted instantiation: x86_emulate.c:_xmalloc_array
Unexecuted instantiation: tboot.c:_xmalloc_array
hpet.c:_xmalloc_array
Line
Count
Source
35
1
{
36
1
    /* Check for overflow. */
37
1
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
1
    return _xmalloc(size * num, align);
40
1
}
Unexecuted instantiation: xstate.c:_xmalloc_array
Unexecuted instantiation: power.c:_xmalloc_array
Unexecuted instantiation: suspend.c:_xmalloc_array
Unexecuted instantiation: cpu_idle.c:_xmalloc_array
Unexecuted instantiation: cpuidle_menu.c:_xmalloc_array
Unexecuted instantiation: powernow.c:_xmalloc_array
Unexecuted instantiation: amd.c:_xmalloc_array
Unexecuted instantiation: centaur.c:_xmalloc_array
Unexecuted instantiation: common.c:_xmalloc_array
Unexecuted instantiation: intel.c:_xmalloc_array
Unexecuted instantiation: intel_cacheinfo.c:_xmalloc_array
Unexecuted instantiation: mwait-idle.c:_xmalloc_array
Unexecuted instantiation: vpmu.c:_xmalloc_array
Unexecuted instantiation: vpmu_amd.c:_xmalloc_array
Unexecuted instantiation: vpmu_intel.c:_xmalloc_array
Unexecuted instantiation: amd_nonfatal.c:_xmalloc_array
Unexecuted instantiation: mce_amd.c:_xmalloc_array
Unexecuted instantiation: mcaction.c:_xmalloc_array
Unexecuted instantiation: barrier.c:_xmalloc_array
mctelem.c:_xmalloc_array
Line
Count
Source
35
1
{
36
1
    /* Check for overflow. */
37
1
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
1
    return _xmalloc(size * num, align);
40
1
}
Unexecuted instantiation: mce.c:_xmalloc_array
Unexecuted instantiation: mce-apei.c:_xmalloc_array
Unexecuted instantiation: mce_intel.c:_xmalloc_array
Unexecuted instantiation: non-fatal.c:_xmalloc_array
Unexecuted instantiation: util.c:_xmalloc_array
Unexecuted instantiation: vmce.c:_xmalloc_array
generic.c:_xmalloc_array
Line
Count
Source
35
1
{
36
1
    /* Check for overflow. */
37
1
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
1
    return _xmalloc(size * num, align);
40
1
}
main.c:_xmalloc_array
Line
Count
Source
35
1
{
36
1
    /* Check for overflow. */
37
1
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
1
    return _xmalloc(size * num, align);
40
1
}
Unexecuted instantiation: bigsmp.c:_xmalloc_array
Unexecuted instantiation: x2apic.c:_xmalloc_array
Unexecuted instantiation: default.c:_xmalloc_array
Unexecuted instantiation: delivery.c:_xmalloc_array
Unexecuted instantiation: probe.c:_xmalloc_array
Unexecuted instantiation: asid.c:_xmalloc_array
Unexecuted instantiation: dm.c:_xmalloc_array
Unexecuted instantiation: emulate.c:_xmalloc_array
Unexecuted instantiation: hvm.c:_xmalloc_array
Unexecuted instantiation: i8254.c:_xmalloc_array
Unexecuted instantiation: intercept.c:_xmalloc_array
Unexecuted instantiation: ioreq.c:_xmalloc_array
Unexecuted instantiation: mtrr.c:_xmalloc_array
Unexecuted instantiation: nestedhvm.c:_xmalloc_array
Unexecuted instantiation: pmtimer.c:_xmalloc_array
Unexecuted instantiation: rtc.c:_xmalloc_array
Unexecuted instantiation: save.c:_xmalloc_array
Unexecuted instantiation: stdvga.c:_xmalloc_array
Unexecuted instantiation: vioapic.c:_xmalloc_array
Unexecuted instantiation: viridian.c:_xmalloc_array
Unexecuted instantiation: vlapic.c:_xmalloc_array
Unexecuted instantiation: vmsi.c:_xmalloc_array
Unexecuted instantiation: vpic.c:_xmalloc_array
Unexecuted instantiation: vpt.c:_xmalloc_array
Unexecuted instantiation: intr.c:_xmalloc_array
Unexecuted instantiation: nestedsvm.c:_xmalloc_array
Unexecuted instantiation: svm.c:_xmalloc_array
Unexecuted instantiation: svmdebug.c:_xmalloc_array
Unexecuted instantiation: vmcb.c:_xmalloc_array
Unexecuted instantiation: realmode.c:_xmalloc_array
Unexecuted instantiation: vmcs.c:_xmalloc_array
Unexecuted instantiation: vmx.c:_xmalloc_array
Unexecuted instantiation: vvmx.c:_xmalloc_array
Unexecuted instantiation: paging.c:_xmalloc_array
Unexecuted instantiation: p2m.c:_xmalloc_array
Unexecuted instantiation: p2m-pt.c:_xmalloc_array
Unexecuted instantiation: p2m-ept.c:_xmalloc_array
Unexecuted instantiation: p2m-pod.c:_xmalloc_array
Unexecuted instantiation: altp2m.c:_xmalloc_array
Unexecuted instantiation: guest_walk.c:_xmalloc_array
Unexecuted instantiation: mem_paging.c:_xmalloc_array
Unexecuted instantiation: mem_sharing.c:_xmalloc_array
Unexecuted instantiation: multi.c:_xmalloc_array
Unexecuted instantiation: hap.c:_xmalloc_array
Unexecuted instantiation: nested_hap.c:_xmalloc_array
Unexecuted instantiation: nested_ept.c:_xmalloc_array
Unexecuted instantiation: nmi_int.c:_xmalloc_array
Unexecuted instantiation: op_model_p4.c:_xmalloc_array
Unexecuted instantiation: op_model_ppro.c:_xmalloc_array
Unexecuted instantiation: op_model_athlon.c:_xmalloc_array
Unexecuted instantiation: backtrace.c:_xmalloc_array
Unexecuted instantiation: callback.c:_xmalloc_array
Unexecuted instantiation: descriptor-tables.c:_xmalloc_array
Unexecuted instantiation: emul-gate-op.c:_xmalloc_array
Unexecuted instantiation: emul-inv-op.c:_xmalloc_array
Unexecuted instantiation: emul-priv-op.c:_xmalloc_array
Unexecuted instantiation: iret.c:_xmalloc_array
Unexecuted instantiation: misc-hypercalls.c:_xmalloc_array
Unexecuted instantiation: ro-page-fault.c:_xmalloc_array
acpi_mmcfg.c:_xmalloc_array
Line
Count
Source
35
1
{
36
1
    /* Check for overflow. */
37
1
    if ( size && num > UINT_MAX / size )
38
0
        return NULL;
39
1
    return _xmalloc(size * num, align);
40
1
}
Unexecuted instantiation: mmconf-fam10h.c:_xmalloc_array
Unexecuted instantiation: mmconfig_64.c:_xmalloc_array
Unexecuted instantiation: mmconfig-shared.c:_xmalloc_array
Unexecuted instantiation: rijndael.c:_xmalloc_array
Unexecuted instantiation: vmac.c:_xmalloc_array
41
42
static inline void *_xzalloc_array(
43
    unsigned long size, unsigned long align, unsigned long num)
44
97
{
45
97
    /* Check for overflow. */
46
97
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
97
    return _xzalloc(size * num, align);
49
97
}
Unexecuted instantiation: stub.c:_xzalloc_array
Unexecuted instantiation: bitmap.c:_xzalloc_array
Unexecuted instantiation: bsearch.c:_xzalloc_array
Unexecuted instantiation: core_parking.c:_xzalloc_array
Unexecuted instantiation: cpu.c:_xzalloc_array
Unexecuted instantiation: cpupool.c:_xzalloc_array
Unexecuted instantiation: domctl.c:_xzalloc_array
domain.c:_xzalloc_array
Line
Count
Source
44
1
{
45
1
    /* Check for overflow. */
46
1
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
1
    return _xzalloc(size * num, align);
49
1
}
Unexecuted instantiation: event_2l.c:_xzalloc_array
event_channel.c:_xzalloc_array
Line
Count
Source
44
5
{
45
5
    /* Check for overflow. */
46
5
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
5
    return _xzalloc(size * num, align);
49
5
}
Unexecuted instantiation: event_fifo.c:_xzalloc_array
grant_table.c:_xzalloc_array
Line
Count
Source
44
3
{
45
3
    /* Check for overflow. */
46
3
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
3
    return _xzalloc(size * num, align);
49
3
}
Unexecuted instantiation: guestcopy.c:_xzalloc_array
irq.c:_xzalloc_array
Line
Count
Source
44
1
{
45
1
    /* Check for overflow. */
46
1
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
1
    return _xzalloc(size * num, align);
49
1
}
Unexecuted instantiation: kernel.c:_xzalloc_array
Unexecuted instantiation: keyhandler.c:_xzalloc_array
Unexecuted instantiation: kexec.c:_xzalloc_array
Unexecuted instantiation: kimage.c:_xzalloc_array
Unexecuted instantiation: lib.c:_xzalloc_array
Unexecuted instantiation: lzo.c:_xzalloc_array
Unexecuted instantiation: mem_access.c:_xzalloc_array
Unexecuted instantiation: memory.c:_xzalloc_array
Unexecuted instantiation: monitor.c:_xzalloc_array
Unexecuted instantiation: multicall.c:_xzalloc_array
Unexecuted instantiation: notifier.c:_xzalloc_array
Unexecuted instantiation: page_alloc.c:_xzalloc_array
Unexecuted instantiation: pdx.c:_xzalloc_array
Unexecuted instantiation: preempt.c:_xzalloc_array
Unexecuted instantiation: random.c:_xzalloc_array
Unexecuted instantiation: rangeset.c:_xzalloc_array
Unexecuted instantiation: radix-tree.c:_xzalloc_array
Unexecuted instantiation: rcupdate.c:_xzalloc_array
Unexecuted instantiation: rwlock.c:_xzalloc_array
Unexecuted instantiation: sched_arinc653.c:_xzalloc_array
sched_credit.c:_xzalloc_array
Line
Count
Source
44
1
{
45
1
    /* Check for overflow. */
46
1
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
1
    return _xzalloc(size * num, align);
49
1
}
Unexecuted instantiation: sched_credit2.c:_xzalloc_array
Unexecuted instantiation: sched_rt.c:_xzalloc_array
Unexecuted instantiation: sched_null.c:_xzalloc_array
Unexecuted instantiation: schedule.c:_xzalloc_array
Unexecuted instantiation: shutdown.c:_xzalloc_array
Unexecuted instantiation: softirq.c:_xzalloc_array
Unexecuted instantiation: smp.c:_xzalloc_array
Unexecuted instantiation: spinlock.c:_xzalloc_array
Unexecuted instantiation: stop_machine.c:_xzalloc_array
Unexecuted instantiation: symbols.c:_xzalloc_array
Unexecuted instantiation: sysctl.c:_xzalloc_array
Unexecuted instantiation: tasklet.c:_xzalloc_array
Unexecuted instantiation: time.c:_xzalloc_array
Unexecuted instantiation: timer.c:_xzalloc_array
Unexecuted instantiation: trace.c:_xzalloc_array
Unexecuted instantiation: version.c:_xzalloc_array
Unexecuted instantiation: virtual_region.c:_xzalloc_array
Unexecuted instantiation: vm_event.c:_xzalloc_array
Unexecuted instantiation: vmap.c:_xzalloc_array
Unexecuted instantiation: vsprintf.c:_xzalloc_array
Unexecuted instantiation: wait.c:_xzalloc_array
Unexecuted instantiation: xenoprof.c:_xzalloc_array
Unexecuted instantiation: xmalloc_tlsf.c:_xzalloc_array
Unexecuted instantiation: xlat.c:_xzalloc_array
Unexecuted instantiation: tmem.c:_xzalloc_array
Unexecuted instantiation: tmem_xen.c:_xzalloc_array
Unexecuted instantiation: tmem_control.c:_xzalloc_array
Unexecuted instantiation: llvm.c:_xzalloc_array
Unexecuted instantiation: libelf-tools.c:_xzalloc_array
Unexecuted instantiation: libelf-loader.c:_xzalloc_array
Unexecuted instantiation: libelf-dominfo.c:_xzalloc_array
Unexecuted instantiation: console.c:_xzalloc_array
Unexecuted instantiation: ns16550.c:_xzalloc_array
Unexecuted instantiation: ehci-dbgp.c:_xzalloc_array
Unexecuted instantiation: serial.c:_xzalloc_array
Unexecuted instantiation: cpufreq.c:_xzalloc_array
Unexecuted instantiation: cpufreq_ondemand.c:_xzalloc_array
Unexecuted instantiation: cpufreq_misc_governors.c:_xzalloc_array
Unexecuted instantiation: utility.c:_xzalloc_array
Unexecuted instantiation: pci.c:_xzalloc_array
Unexecuted instantiation: vpci.c:_xzalloc_array
Unexecuted instantiation: header.c:_xzalloc_array
Unexecuted instantiation: msi.c:_xzalloc_array
Unexecuted instantiation: msix.c:_xzalloc_array
iommu.c:_xzalloc_array
Line
Count
Source
44
2
{
45
2
    /* Check for overflow. */
46
2
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
2
    return _xzalloc(size * num, align);
49
2
}
Unexecuted instantiation: io.c:_xzalloc_array
dmar.c:_xzalloc_array
Line
Count
Source
44
3
{
45
3
    /* Check for overflow. */
46
3
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
3
    return _xzalloc(size * num, align);
49
3
}
Unexecuted instantiation: utils.c:_xzalloc_array
Unexecuted instantiation: qinval.c:_xzalloc_array
Unexecuted instantiation: intremap.c:_xzalloc_array
Unexecuted instantiation: quirks.c:_xzalloc_array
Unexecuted instantiation: vtd.c:_xzalloc_array
Unexecuted instantiation: ats.c:_xzalloc_array
Unexecuted instantiation: iommu_init.c:_xzalloc_array
Unexecuted instantiation: iommu_map.c:_xzalloc_array
Unexecuted instantiation: pci_amd_iommu.c:_xzalloc_array
Unexecuted instantiation: iommu_intr.c:_xzalloc_array
Unexecuted instantiation: iommu_cmd.c:_xzalloc_array
Unexecuted instantiation: iommu_guest.c:_xzalloc_array
Unexecuted instantiation: numa.c:_xzalloc_array
Unexecuted instantiation: osl.c:_xzalloc_array
Unexecuted instantiation: pmstat.c:_xzalloc_array
Unexecuted instantiation: hwregs.c:_xzalloc_array
Unexecuted instantiation: reboot.c:_xzalloc_array
Unexecuted instantiation: tbutils.c:_xzalloc_array
Unexecuted instantiation: utglobal.c:_xzalloc_array
Unexecuted instantiation: erst.c:_xzalloc_array
Unexecuted instantiation: hest.c:_xzalloc_array
Unexecuted instantiation: apei-base.c:_xzalloc_array
Unexecuted instantiation: apei-io.c:_xzalloc_array
Unexecuted instantiation: vga.c:_xzalloc_array
Unexecuted instantiation: lfb.c:_xzalloc_array
Unexecuted instantiation: vesa.c:_xzalloc_array
Unexecuted instantiation: xsm_core.c:_xzalloc_array
Unexecuted instantiation: apic.c:_xzalloc_array
Unexecuted instantiation: bitops.c:_xzalloc_array
Unexecuted instantiation: cpuid.c:_xzalloc_array
Unexecuted instantiation: compat.c:_xzalloc_array
Unexecuted instantiation: crash.c:_xzalloc_array
Unexecuted instantiation: debug.c:_xzalloc_array
Unexecuted instantiation: delay.c:_xzalloc_array
Unexecuted instantiation: domain_page.c:_xzalloc_array
Unexecuted instantiation: e820.c:_xzalloc_array
Unexecuted instantiation: extable.c:_xzalloc_array
Unexecuted instantiation: flushtlb.c:_xzalloc_array
Unexecuted instantiation: hypercall.c:_xzalloc_array
Unexecuted instantiation: i387.c:_xzalloc_array
Unexecuted instantiation: i8259.c:_xzalloc_array
io_apic.c:_xzalloc_array
Line
Count
Source
44
1
{
45
1
    /* Check for overflow. */
46
1
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
1
    return _xzalloc(size * num, align);
49
1
}
Unexecuted instantiation: msr.c:_xzalloc_array
Unexecuted instantiation: ioport_emulate.c:_xzalloc_array
Unexecuted instantiation: machine_kexec.c:_xzalloc_array
Unexecuted instantiation: microcode_amd.c:_xzalloc_array
Unexecuted instantiation: microcode_intel.c:_xzalloc_array
Unexecuted instantiation: microcode.c:_xzalloc_array
Unexecuted instantiation: mm.c:_xzalloc_array
Unexecuted instantiation: mpparse.c:_xzalloc_array
Unexecuted instantiation: nmi.c:_xzalloc_array
Unexecuted instantiation: percpu.c:_xzalloc_array
Unexecuted instantiation: physdev.c:_xzalloc_array
Unexecuted instantiation: platform_hypercall.c:_xzalloc_array
Unexecuted instantiation: psr.c:_xzalloc_array
Unexecuted instantiation: setup.c:_xzalloc_array
smpboot.c:_xzalloc_array
Line
Count
Source
44
1
{
45
1
    /* Check for overflow. */
46
1
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
1
    return _xzalloc(size * num, align);
49
1
}
Unexecuted instantiation: srat.c:_xzalloc_array
Unexecuted instantiation: string.c:_xzalloc_array
Unexecuted instantiation: traps.c:_xzalloc_array
Unexecuted instantiation: usercopy.c:_xzalloc_array
Unexecuted instantiation: x86_emulate.c:_xzalloc_array
Unexecuted instantiation: tboot.c:_xzalloc_array
Unexecuted instantiation: hpet.c:_xzalloc_array
xstate.c:_xzalloc_array
Line
Count
Source
44
2
{
45
2
    /* Check for overflow. */
46
2
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
2
    return _xzalloc(size * num, align);
49
2
}
Unexecuted instantiation: power.c:_xzalloc_array
Unexecuted instantiation: suspend.c:_xzalloc_array
Unexecuted instantiation: cpu_idle.c:_xzalloc_array
Unexecuted instantiation: cpuidle_menu.c:_xzalloc_array
Unexecuted instantiation: powernow.c:_xzalloc_array
Unexecuted instantiation: amd.c:_xzalloc_array
Unexecuted instantiation: centaur.c:_xzalloc_array
Unexecuted instantiation: common.c:_xzalloc_array
Unexecuted instantiation: intel.c:_xzalloc_array
Unexecuted instantiation: intel_cacheinfo.c:_xzalloc_array
Unexecuted instantiation: mwait-idle.c:_xzalloc_array
Unexecuted instantiation: vpmu.c:_xzalloc_array
Unexecuted instantiation: vpmu_amd.c:_xzalloc_array
Unexecuted instantiation: vpmu_intel.c:_xzalloc_array
Unexecuted instantiation: amd_nonfatal.c:_xzalloc_array
Unexecuted instantiation: mce_amd.c:_xzalloc_array
Unexecuted instantiation: mcaction.c:_xzalloc_array
Unexecuted instantiation: barrier.c:_xzalloc_array
Unexecuted instantiation: mctelem.c:_xzalloc_array
mce.c:_xzalloc_array
Line
Count
Source
44
49
{
45
49
    /* Check for overflow. */
46
49
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
49
    return _xzalloc(size * num, align);
49
49
}
Unexecuted instantiation: mce-apei.c:_xzalloc_array
Unexecuted instantiation: mce_intel.c:_xzalloc_array
Unexecuted instantiation: non-fatal.c:_xzalloc_array
Unexecuted instantiation: util.c:_xzalloc_array
Unexecuted instantiation: vmce.c:_xzalloc_array
Unexecuted instantiation: generic.c:_xzalloc_array
Unexecuted instantiation: main.c:_xzalloc_array
Unexecuted instantiation: bigsmp.c:_xzalloc_array
Unexecuted instantiation: x2apic.c:_xzalloc_array
Unexecuted instantiation: default.c:_xzalloc_array
Unexecuted instantiation: delivery.c:_xzalloc_array
Unexecuted instantiation: probe.c:_xzalloc_array
Unexecuted instantiation: asid.c:_xzalloc_array
Unexecuted instantiation: dm.c:_xzalloc_array
Unexecuted instantiation: emulate.c:_xzalloc_array
hvm.c:_xzalloc_array
Line
Count
Source
44
2
{
45
2
    /* Check for overflow. */
46
2
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
2
    return _xzalloc(size * num, align);
49
2
}
Unexecuted instantiation: i8254.c:_xzalloc_array
Unexecuted instantiation: intercept.c:_xzalloc_array
Unexecuted instantiation: ioreq.c:_xzalloc_array
mtrr.c:_xzalloc_array
Line
Count
Source
44
12
{
45
12
    /* Check for overflow. */
46
12
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
12
    return _xzalloc(size * num, align);
49
12
}
Unexecuted instantiation: nestedhvm.c:_xzalloc_array
Unexecuted instantiation: pmtimer.c:_xzalloc_array
Unexecuted instantiation: rtc.c:_xzalloc_array
Unexecuted instantiation: save.c:_xzalloc_array
Unexecuted instantiation: stdvga.c:_xzalloc_array
vioapic.c:_xzalloc_array
Line
Count
Source
44
1
{
45
1
    /* Check for overflow. */
46
1
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
1
    return _xzalloc(size * num, align);
49
1
}
Unexecuted instantiation: viridian.c:_xzalloc_array
Unexecuted instantiation: vlapic.c:_xzalloc_array
Unexecuted instantiation: vmsi.c:_xzalloc_array
Unexecuted instantiation: vpic.c:_xzalloc_array
Unexecuted instantiation: vpt.c:_xzalloc_array
Unexecuted instantiation: intr.c:_xzalloc_array
Unexecuted instantiation: nestedsvm.c:_xzalloc_array
Unexecuted instantiation: svm.c:_xzalloc_array
Unexecuted instantiation: svmdebug.c:_xzalloc_array
Unexecuted instantiation: vmcb.c:_xzalloc_array
Unexecuted instantiation: realmode.c:_xzalloc_array
Unexecuted instantiation: vmcs.c:_xzalloc_array
Unexecuted instantiation: vmx.c:_xzalloc_array
vvmx.c:_xzalloc_array
Line
Count
Source
44
12
{
45
12
    /* Check for overflow. */
46
12
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
12
    return _xzalloc(size * num, align);
49
12
}
Unexecuted instantiation: paging.c:_xzalloc_array
Unexecuted instantiation: p2m.c:_xzalloc_array
Unexecuted instantiation: p2m-pt.c:_xzalloc_array
Unexecuted instantiation: p2m-ept.c:_xzalloc_array
Unexecuted instantiation: p2m-pod.c:_xzalloc_array
Unexecuted instantiation: altp2m.c:_xzalloc_array
Unexecuted instantiation: guest_walk.c:_xzalloc_array
Unexecuted instantiation: mem_paging.c:_xzalloc_array
Unexecuted instantiation: mem_sharing.c:_xzalloc_array
Unexecuted instantiation: multi.c:_xzalloc_array
Unexecuted instantiation: hap.c:_xzalloc_array
Unexecuted instantiation: nested_hap.c:_xzalloc_array
Unexecuted instantiation: nested_ept.c:_xzalloc_array
Unexecuted instantiation: nmi_int.c:_xzalloc_array
Unexecuted instantiation: op_model_p4.c:_xzalloc_array
Unexecuted instantiation: op_model_ppro.c:_xzalloc_array
Unexecuted instantiation: op_model_athlon.c:_xzalloc_array
Unexecuted instantiation: backtrace.c:_xzalloc_array
Unexecuted instantiation: callback.c:_xzalloc_array
Unexecuted instantiation: descriptor-tables.c:_xzalloc_array
Unexecuted instantiation: emul-gate-op.c:_xzalloc_array
Unexecuted instantiation: emul-inv-op.c:_xzalloc_array
Unexecuted instantiation: emul-priv-op.c:_xzalloc_array
Unexecuted instantiation: iret.c:_xzalloc_array
Unexecuted instantiation: misc-hypercalls.c:_xzalloc_array
Unexecuted instantiation: ro-page-fault.c:_xzalloc_array
Unexecuted instantiation: acpi_mmcfg.c:_xzalloc_array
Unexecuted instantiation: mmconf-fam10h.c:_xzalloc_array
mmconfig_64.c:_xzalloc_array
Line
Count
Source
44
1
{
45
1
    /* Check for overflow. */
46
1
    if ( size && num > UINT_MAX / size )
47
0
        return NULL;
48
1
    return _xzalloc(size * num, align);
49
1
}
Unexecuted instantiation: mmconfig-shared.c:_xzalloc_array
Unexecuted instantiation: rijndael.c:_xzalloc_array
Unexecuted instantiation: vmac.c:_xzalloc_array
50
51
/*
52
 * Pooled allocator interface.
53
 */
54
55
struct xmem_pool;
56
57
typedef void *(xmem_pool_get_memory)(unsigned long bytes);
58
typedef void (xmem_pool_put_memory)(void *ptr);
59
60
/**
61
 * xmem_pool_create - create dynamic memory pool
62
 * @name: name of the pool
63
 * @get_mem: callback function used to expand pool
64
 * @put_mem: callback function used to shrink pool
65
 * @init_size: inital pool size (in bytes)
66
 * @max_size: maximum pool size (in bytes) - set this as 0 for no limit
67
 * @grow_size: amount of memory (in bytes) added to pool whenever required
68
 *
69
 * All size values are rounded up to next page boundary.
70
 */
71
struct xmem_pool *xmem_pool_create(
72
    const char *name,
73
    xmem_pool_get_memory get_mem,
74
    xmem_pool_put_memory put_mem,
75
    unsigned long init_size,
76
    unsigned long max_size,
77
    unsigned long grow_size);
78
79
/**
80
 * xmem_pool_destroy - cleanup given pool
81
 * @mem_pool: Pool to be destroyed
82
 *
83
 * Data structures associated with pool are freed.
84
 * All memory allocated from pool must be freed before
85
 * destorying it.
86
 */
87
void xmem_pool_destroy(struct xmem_pool *pool);
88
89
/**
90
 * xmem_pool_alloc - allocate memory from given pool
91
 * @size: no. of bytes
92
 * @mem_pool: pool to allocate from
93
 */
94
void *xmem_pool_alloc(unsigned long size, struct xmem_pool *pool);
95
96
/**
97
 * xmem_pool_maxalloc - xmem_pool_alloc's greater than this size will fail
98
 * @mem_pool: pool
99
 */
100
int xmem_pool_maxalloc(struct xmem_pool *pool);
101
102
/**
103
 * xmem_pool_maxsize - 
104
 * @ptr: address of memory to be freed
105
 * @mem_pool: pool to free from
106
 */
107
void xmem_pool_free(void *ptr, struct xmem_pool *pool);
108
109
/**
110
 * xmem_pool_get_used_size - get memory currently used by given pool
111
 *
112
 * Used memory includes stored data + metadata + internal fragmentation
113
 */
114
unsigned long xmem_pool_get_used_size(struct xmem_pool *pool);
115
116
/**
117
 * xmem_pool_get_total_size - get total memory currently allocated for pool
118
 *
119
 * This is the total memory currently allocated for this pool which includes
120
 * used size + free size.
121
 *
122
 * (Total - Used) is good indicator of memory efficiency of allocator.
123
 */
124
unsigned long xmem_pool_get_total_size(struct xmem_pool *pool);
125
126
#endif /* __XMALLOC_H__ */