Skip to content

Commit

Permalink
Code analysis failure
Browse files Browse the repository at this point in the history
Signed-off-by: Alan Jowett <[email protected]>
  • Loading branch information
Alan Jowett committed Mar 3, 2024
1 parent eac3ee9 commit 5298dec
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions libs/execution_context/ebpf_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,20 @@ _ebpf_core_memcpy(

static int32_t
_ebpf_core_memcmp(
_In_reads_(length) const void* buffer1,
_In_reads_(buffer1_length) const void* buffer1,
size_t buffer1_length,
_In_reads_(length) const void* buffer2,
_In_reads_(buffer2_length) const void* buffer2,
size_t buffer2_length);

static uintptr_t
_ebpf_core_memset(_Out_writes_(length) void* buffer, size_t length, int value);

static int32_t
_ebpf_core_memmove(
_Out_writes_(length) void* destination, size_t length, _In_reads_(length) const void* source, size_t source_length);
_Out_writes_(destination_length) void* destination,
size_t destination_length,
_In_reads_(source_length) const void* source,
size_t source_length);

#define EBPF_CORE_GLOBAL_HELPER_EXTENSION_VERSION 0

Expand Down Expand Up @@ -2385,9 +2388,9 @@ _ebpf_core_memset(_Out_writes_(length) void* buffer, size_t length, int value)

static int32_t
_ebpf_core_memcmp(
_In_reads_(length) const void* buffer1,
_In_reads_(buffer1_length) const void* buffer1,
size_t buffer1_length,
_In_reads_(length) const void* buffer2,
_In_reads_(buffer2_length) const void* buffer2,
size_t buffer2_length)
{
int32_t result = memcmp(buffer1, buffer2, buffer1_length < buffer2_length ? buffer1_length : buffer2_length);
Expand All @@ -2404,17 +2407,17 @@ _ebpf_core_memcmp(
return result;
}

static ebpf_result_t
static int32_t
_ebpf_core_memmove(
_Out_writes_bytes_all_(length) void* destination,
size_t destination_size,
_In_reads_bytes_(length) const void* source,
_Out_writes_(destination_length) void* destination,
size_t destination_length,
_In_reads_(source_length) const void* source,
size_t source_length)
{
if (source_length > destination_size) {
if (source_length > destination_length) {
return -EINVAL;
}
return memmove_s(destination, destination_size, source, source_length);
return memmove_s(destination, destination_length, source, source_length);
}

typedef enum _ebpf_protocol_call_type
Expand Down

0 comments on commit 5298dec

Please sign in to comment.