Skip to content

Commit

Permalink
fix uninitialized field (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehri01 committed Sep 11, 2024
1 parent b633f0c commit 0442b07
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
./replit-ebpf
./result
.direnv/
4 changes: 4 additions & 0 deletions bdwatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ int BPF_KPROBE(btrfs_recover_log_trees, struct btrfs_root *root_tree) {
BPF_CORE_READ_INTO(&evt.label, root_tree, fs_info, super_copy, label);
BPF_CORE_READ_INTO(&evt.fsid, root_tree, fs_info, super_copy, fsid);

// This will be filled later in kretprobe but the verifier
// requires all fields to be initialized.
evt.ret = 0;

bool *registered = bpf_map_lookup_elem(&registered_devices, &evt.dev_id);
if (registered == NULL || !*registered) {
return 0;
Expand Down
Binary file modified bdwatch_x86_bpfel.o
Binary file not shown.

0 comments on commit 0442b07

Please sign in to comment.