mirror of https://github.com/golang/go.git
cmd/link: fix invalid usage of reflect.SliceHeader
Caught by "go vet" built with golang.org/cl/248192. Change-Id: I446083533dd82ecef8db591beb7bd3d70b040d4a Reviewed-on: https://go-review.googlesource.com/c/go/+/268099 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
This commit is contained in:
parent
bb9a96d03a
commit
2c80de74d5
|
|
@ -35,7 +35,10 @@ func (out *OutBuf) Mmap(filesize uint64) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*(*reflect.SliceHeader)(unsafe.Pointer(&out.buf)) = reflect.SliceHeader{Data: ptr, Len: int(filesize), Cap: int(filesize)}
|
||||
bufHdr := (*reflect.SliceHeader)(unsafe.Pointer(&out.buf))
|
||||
bufHdr.Data = ptr
|
||||
bufHdr.Len = int(filesize)
|
||||
bufHdr.Cap = int(filesize)
|
||||
|
||||
// copy heap to new mapping
|
||||
if uint64(oldlen+len(out.heap)) > filesize {
|
||||
|
|
|
|||
Loading…
Reference in New Issue