Skip to content

Commit 9e89dda

Browse files
Ensure 64bit math for SD card FSInfo (earlephilhower#1553)
Fixes earlephilhower#1552 Ensure that 64 bit multiplication is done when calculating the total size available and used for SDFS.
1 parent 91e69e2 commit 9e89dda

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libraries/SDFS/src/SDFS.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ class SDFSImpl : public FSImpl {
101101
info.blockSize = _fs.vol()->bytesPerCluster();
102102
info.pageSize = 0; // TODO ?
103103
info.maxPathLength = 255; // TODO ?
104-
info.totalBytes = _fs.vol()->clusterCount() * info.blockSize;
105-
info.usedBytes = info.totalBytes - (_fs.vol()->freeClusterCount() * _fs.vol()->bytesPerCluster());
104+
info.totalBytes = (uint64_t)_fs.vol()->clusterCount() * (uint64_t)info.blockSize;
105+
info.usedBytes = info.totalBytes - ((uint64_t)_fs.vol()->freeClusterCount() * (uint64_t)_fs.vol()->bytesPerCluster());
106106
return true;
107107
}
108108

0 commit comments

Comments
 (0)