memfs: GetVolumeInfo: ensure correct TotalSize and FreeSize calculations

This commit is contained in:
Bill Zissimopoulos 2016-04-13 20:52:04 -07:00
parent 1239c610a5
commit 9df1c47a94

View File

@ -248,9 +248,9 @@ static NTSTATUS GetVolumeInfo(FSP_FILE_SYSTEM *FileSystem,
{
MEMFS *Memfs = (MEMFS *)FileSystem->UserContext;
VolumeInfo->TotalSize = Memfs->MaxFileNodes * Memfs->MaxFileSize;
VolumeInfo->FreeSize =
(Memfs->MaxFileNodes - MemfsFileNodeMapCount(Memfs->FileNodeMap)) * Memfs->MaxFileSize;
VolumeInfo->TotalSize = Memfs->MaxFileNodes * (UINT64)Memfs->MaxFileSize;
VolumeInfo->FreeSize = (Memfs->MaxFileNodes - MemfsFileNodeMapCount(Memfs->FileNodeMap)) *
(UINT64)Memfs->MaxFileSize;
VolumeInfo->VolumeLabelLength = Memfs->VolumeLabelLength;
memcpy(VolumeInfo->VolumeLabel, Memfs->VolumeLabel, Memfs->VolumeLabelLength);