mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-01 09:25:21 +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:
parent
463c9b8e56
commit
bc4a1fd16c
@ -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)
|
||||
}
|
||||
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user