Fix integer overflow when calculating block device size
This commit is contained in:
1 parent
7ea174003a
commit
2feef68d75
2 files changed
+2
-2
No files matched your search
@@ -78,7 +78,7 @@ class BlockDeviceInputStream(
|
||||
* The size of the block device in bytes.
|
||||
*/
|
||||
private val sizeBytes: Long
|
||||
get() = blockDev.blocks * blockDev.blockSize
|
||||
get() = blockDev.blocks.toLong() * blockDev.blockSize
|
||||
|
||||
/**
|
||||
* Whether the stream is at or past the end of the block device.
|
||||
|
||||
@@ -366,7 +366,7 @@ class WorkerService : LifecycleService() {
|
||||
// Resume a few blocks earlier in case things went haywire earlier
|
||||
currentOffset = max(currentOffset - blockDev.blockSize * BUFFER_BLOCKS * 2, 0L)
|
||||
|
||||
val devSize = blockDev.blocks * blockDev.blockSize
|
||||
val devSize = blockDev.blocks.toLong() * blockDev.blockSize
|
||||
Telemetry.debug(
|
||||
"Device size: ${devSize.toHRSize(false)} " +
|
||||
"(block size: ${blockDev.blockSize.toHRSize(false)}, " +
|
||||
|
||||
Reference in new issue
Block a user