Skip to content

Commit

Permalink
fix(bpf): initialize some variables
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <[email protected]>
Co-authored-by: Federico Di Pierro <[email protected]>
  • Loading branch information
Andreagit97 and FedeDP committed Oct 5, 2023
1 parent 42963c2 commit 39c97da
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions driver/bpf/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ int bpf_##event(struct type *ctx)

BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)
{
const struct syscall_evt_pair *sc_evt;
const struct syscall_evt_pair *sc_evt = NULL;
ppm_event_code evt_type = -1;
int drop_flags;
long id;
bool enabled;
int drop_flags = 0;
long id = 0;
bool enabled = false;
int socketcall_syscall_id = -1;

#ifdef __NR_socketcall
Expand Down Expand Up @@ -78,7 +78,7 @@ BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)

if(id == socketcall_syscall_id)
{
bool is_syscall_return;
bool is_syscall_return = false;
int return_code = convert_network_syscalls(ctx, &is_syscall_return);
/* If we return an event code, it means we need to call directly `record_event_all_consumers` */
if(!is_syscall_return)
Expand Down Expand Up @@ -135,13 +135,13 @@ BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)

BPF_PROBE("raw_syscalls/", sys_exit, sys_exit_args)
{
const struct syscall_evt_pair *sc_evt;
const struct syscall_evt_pair *sc_evt = NULL;
ppm_event_code evt_type = -1;
int drop_flags;
long id;
bool enabled;
struct scap_bpf_settings *settings;
long retval;
int drop_flags = 0;
long id = 0;
bool enabled = false;
struct scap_bpf_settings *settings = 0;
long retval = 0;
int socketcall_syscall_id = -1;

#ifdef __NR_socketcall
Expand Down

0 comments on commit 39c97da

Please sign in to comment.