Skip to content

Commit ef7d704

Browse files
committed
elf: KeySize of a struct_ops map should always be 4
Signed-off-by: shun159 <[email protected]>
1 parent 025f0f2 commit ef7d704

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

elf_reader.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,7 @@ func (ec *elfCode) loadStructOpsMaps() error {
14771477
Name: mapName,
14781478
Type: StructOpsMap,
14791479
Key: &btf.Int{Size: 4},
1480+
KeySize: 4,
14801481
Value: userType,
14811482
Flags: flags,
14821483
MaxEntries: 1,

elf_reader_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,7 @@ func TestStructOps(t *testing.T) {
955955
MaxEntries: 1,
956956
Flags: sys.BPF_F_LINK,
957957
Key: &btf.Int{Size: 4},
958+
KeySize: 4,
958959
Value: &btf.Struct{
959960
Name: "bpf_testmod_ops",
960961
Size: 24,

0 commit comments

Comments
 (0)