Skip to content

Commit

Permalink
refactor(internal/bpf): remove empty var block and use constants
Browse files Browse the repository at this point in the history
  • Loading branch information
nullswan committed Sep 12, 2024
1 parent 3fa772b commit 929c36f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions internal/bpf/whitelist_attacher.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ import (
const (
// Map name for the whitelist of syscalls.
syscallsWhitelistMapName = "syscall_whitelist"
intSz = 4
)

var ()

func registerWhitelistedSyscalls(
log *slog.Logger,
maps map[string]*ebpf.Map,
Expand All @@ -30,10 +29,10 @@ func registerWhitelistedSyscalls(

for _, nbr := range bpfarch.WhitelistedSyscalls {
syscallName := bpfarch.IdToSyscall[nbr]
buf := make([]byte, 4)
buf := make([]byte, intSz)
binary.LittleEndian.PutUint32(buf, uint32(nbr))

placeholder := make([]byte, 4)
placeholder := make([]byte, intSz)
if err := syscallMap.Update(
buf,
placeholder,
Expand Down

0 comments on commit 929c36f

Please sign in to comment.