mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: vhdx: use checked_add in read and write functions
Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -119,7 +119,7 @@ impl Read for Vhdx {
|
|||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
self.current_offset += result as u64;
|
self.current_offset = self.current_offset.checked_add(result as u64).unwrap();
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ impl Write for Vhdx {
|
|||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
self.current_offset += result as u64;
|
self.current_offset = self.current_offset.checked_add(result as u64).unwrap();
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user