summaryrefslogtreecommitdiffhomepage
path: root/pkg/flipcall/flipcall_unsafe.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2021-02-18 01:45:49 +0000
committergVisor bot <gvisor-bot@google.com>2021-02-18 01:45:49 +0000
commit2d9dc3c1b7be34442f224a10013dd5f3823c962a (patch)
treee25228b2da4ae13353eb247d3771352a182fb41e /pkg/flipcall/flipcall_unsafe.go
parent45be62df210badd412752214925e0de28887ed54 (diff)
parentf051ec64639b83faabcfe766ff078072def3c2aa (diff)
Merge release-20210208.0-64-gf051ec646 (automated)
Diffstat (limited to 'pkg/flipcall/flipcall_unsafe.go')
-rw-r--r--pkg/flipcall/flipcall_unsafe.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/pkg/flipcall/flipcall_unsafe.go b/pkg/flipcall/flipcall_unsafe.go
index 580bf23a4..613ed8943 100644
--- a/pkg/flipcall/flipcall_unsafe.go
+++ b/pkg/flipcall/flipcall_unsafe.go
@@ -61,13 +61,12 @@ func (ep *Endpoint) dataLen() *uint32 {
// - Writers must not assume that they will read back the same data that they
// have written. In other words, writers should avoid reading from Data() at
// all.
-func (ep *Endpoint) Data() []byte {
- var bs []byte
- bsReflect := (*reflect.SliceHeader)(unsafe.Pointer(&bs))
- bsReflect.Data = ep.packet + PacketHeaderBytes
- bsReflect.Len = int(ep.dataCap)
- bsReflect.Cap = int(ep.dataCap)
- return bs
+func (ep *Endpoint) Data() (bs []byte) {
+ bshdr := (*reflect.SliceHeader)(unsafe.Pointer(&bs))
+ bshdr.Data = ep.packet + PacketHeaderBytes
+ bshdr.Len = int(ep.dataCap)
+ bshdr.Cap = int(ep.dataCap)
+ return
}
// ioSync is a dummy variable used to indicate synchronization to the Go race