Coverage Report

Created: 2026-03-12 07:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libspdm/os_stub/memlib/copy_mem.c
Line
Count
Source
1
/**
2
 *  Copyright Notice:
3
 *  Copyright 2021-2022 DMTF. All rights reserved.
4
 *  License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
5
 **/
6
7
#include "library/debuglib.h"
8
#include "hal/library/memlib.h"
9
10
void libspdm_copy_mem(void *dst_buf, size_t dst_len,
11
                      const void *src_buf, size_t src_len)
12
799k
{
13
799k
    volatile uint8_t* dst;
14
799k
    const volatile uint8_t* src;
15
16
799k
    dst = (volatile uint8_t*) dst_buf;
17
799k
    src = (const volatile uint8_t*) src_buf;
18
19
799k
    if ((dst == NULL) || (src == NULL)) {
20
0
        LIBSPDM_ASSERT(0);
21
0
    }
22
799k
    if (((src < dst) && ((src + src_len) > dst)) || ((dst < src) && ((dst + src_len) > src))) {
23
0
        LIBSPDM_ASSERT(0);
24
0
    }
25
799k
    if (src_len > dst_len) {
26
0
        LIBSPDM_ASSERT(0);
27
0
    }
28
29
95.6M
    while (src_len-- != 0) {
30
94.8M
        *(dst++) = *(src++);
31
94.8M
    }
32
799k
}