lib/fs: properly handle the case when data=nil is passed to mUnmap

This commit is contained in:
Aliaksandr Valialkin 2024-02-29 17:26:07 +02:00
parent 22acd84019
commit ddc61e2309
No known key found for this signature in database
GPG key ID: 52C003EE2BCDB9EB

View file

@ -101,7 +101,7 @@ func mmap(fd int, length int) ([]byte, error) {
func mUnmap(data []byte) error {
// flush is not needed, since we perform only reading operation.
// In case of write, additional call FlushViewOfFile must be performed.
addr := uintptr(unsafe.Pointer(&data[0]))
addr := uintptr(unsafe.Pointer(unsafe.SliceData(data)))
mmapByAddrLock.Lock()
h, ok := mmapByAddr[addr]