File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ KCOVInstance::KCOVInstance(ProcessID pid)
17
17
18
18
KResult KCOVInstance::buffer_allocate (size_t buffer_size_in_entries)
19
19
{
20
+ if (buffer_size_in_entries < 2 || buffer_size_in_entries > KCOV_MAX_ENTRIES)
21
+ return EINVAL;
22
+
20
23
// first entry contains index of last PC
21
24
this ->m_buffer_size_in_entries = buffer_size_in_entries - 1 ;
22
25
this ->m_buffer_size_in_bytes = page_round_up (buffer_size_in_entries * KCOV_ENTRY_SIZE);
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ namespace Kernel {
14
14
// Note: These need to be kept in sync with Userland/Libraries/LibC/sys/kcov.h
15
15
typedef volatile u64 kcov_pc_t ;
16
16
#define KCOV_ENTRY_SIZE sizeof (kcov_pc_t )
17
+ #define KCOV_MAX_ENTRIES (10 * 1024 * 1024 )
17
18
18
19
/*
19
20
* One KCOVInstance is allocated per process, when the process opens /dev/kcov
You can’t perform that action at this time.
0 commit comments