mirror of
https://git.zx2c4.com/wireguard-go
synced 2025-10-08 01:50:16 +08:00
device: fix alignment on 32-bit machines and test for it
The test previously checked the offset within a substruct, not the offset within the allocated struct, so this adds the two together. It then fixes an alignment crash on 32-bit machines. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -61,6 +61,5 @@ func TestDeviceAlignment(t *testing.T) {
|
||||
field.Type.Align(),
|
||||
)
|
||||
}
|
||||
|
||||
checkAlignment(t, "Device.rate.underLoadUntil", unsafe.Offsetof(d.rate.underLoadUntil))
|
||||
checkAlignment(t, "Device.rate.underLoadUntil", unsafe.Offsetof(d.rate)+unsafe.Offsetof(d.rate.underLoadUntil))
|
||||
}
|
||||
|
Reference in New Issue
Block a user